From 61315a6a9297f893af7298fd11805672ce211fce Mon Sep 17 00:00:00 2001 From: dkyuuum Date: Tue, 20 Feb 2024 19:57:14 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=ED=96=A5=ED=9B=84=EA=B3=84=ED=9A=8D/?= =?UTF-8?q?=EC=8B=9C=EA=B0=84=ED=91=9C=20=ED=83=AD=20=EC=A0=84=ED=99=98=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20#50?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/data/network/api/PlanApi.kt | 19 +- .../mobile/project/ui/home/HomeFragment.kt | 2 +- .../project/ui/plan/PlanTimetableFragment.kt | 208 ++++++------- .../mobile/project/ui/plan/PlanViewModel.kt | 30 +- .../project/ui/plan/PlanlicenseFragment.kt | 282 +++++++++++------- .../main/res/layout/fragment_planlicense.xml | 117 ++++---- app/src/main/res/values/strings.xml | 3 + 7 files changed, 373 insertions(+), 288 deletions(-) diff --git a/app/src/main/java/umc/com/mobile/project/data/network/api/PlanApi.kt b/app/src/main/java/umc/com/mobile/project/data/network/api/PlanApi.kt index 6c8157c..ad4ac32 100644 --- a/app/src/main/java/umc/com/mobile/project/data/network/api/PlanApi.kt +++ b/app/src/main/java/umc/com/mobile/project/data/network/api/PlanApi.kt @@ -29,9 +29,13 @@ interface PlanApi { @GET("plans/certifications") fun getUPlicense(): Call + @POST("plans/certifications") fun saveLicense(@Body request: List): Call + + + @GET("/plans/timetable/searchSubject") fun getListTime(@Query("hakki") hakki:String, @Query("track") track : String) : Call @@ -51,14 +55,25 @@ interface PlanApi { fun postFreeMemo(@Body request: PlanFreeRequest): Call @GET("/plans/timetable") - fun getUptime(@Query("grade") grade:Int, @Query("semseter") semester : Int):Call + fun getUptime(@Query("grade") grade:Int, @Query("semester") semester : Int):Call @PATCH("/plans/memo") fun editMemo(@Body editMemoRequest: EditMemoRequest) : Call @PATCH("/plans/certifications") - fun certificateLicense(@Body request: CertificateLicenseRequest) : Call + fun certificateLicense(@Body request: List) : Call @DELETE("/plans/certifications") fun deleteLicense(@Query("certificateId") certificateId: Long): Call + + + + + + + + + + + } \ No newline at end of file diff --git a/app/src/main/java/umc/com/mobile/project/ui/home/HomeFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/home/HomeFragment.kt index 46dee1e..bf637b6 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/home/HomeFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/home/HomeFragment.kt @@ -56,7 +56,7 @@ class HomeFragment : Fragment() { // 페이지 이동 private fun navigateFragment() { binding.btnCheeringWordMove.setOnClickListener { - navigate(R.id.action_fragment_home_to_planTimetableFragment) + navigate(R.id.action_fragment_home_to_fragment_date) } binding.layoutNextPlan.setOnClickListener { navigate(R.id.action_fragment_home_to_planTimetableFragment) diff --git a/app/src/main/java/umc/com/mobile/project/ui/plan/PlanTimetableFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/plan/PlanTimetableFragment.kt index 8db4a10..88c97d4 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/plan/PlanTimetableFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/plan/PlanTimetableFragment.kt @@ -1,6 +1,7 @@ package umc.com.mobile.project.ui.plan import android.os.Bundle +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -17,157 +18,158 @@ import umc.com.mobile.project.ui.common.NavigationUtil.navigate class PlanTimetableFragment : Fragment() { - private var _binding: PlanTimeMainBinding? = null - private val binding get() = _binding!! - private val viewModel: PlanViewModel by activityViewModels() - private lateinit var adapter: PlanTimeAdapter + private var _binding: PlanTimeMainBinding? = null + private val binding get() = _binding!! + private val viewModel: PlanViewModel by activityViewModels() + private lateinit var adapter: PlanTimeAdapter - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? - ): View { - _binding = PlanTimeMainBinding.inflate(inflater, container, false) - return binding.root - } + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = PlanTimeMainBinding.inflate(inflater, container, false) + return binding.root + } - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - setupRecyclerView() - observeSelectedTimeResults() + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + setupRecyclerView() + observeSelectedTimeResults() - val spinner = binding.spinnerPlanTimeTrackSemester - val adapter = ArrayAdapter.createFromResource( - requireContext(), - R.array.semester_options, - android.R.layout.simple_spinner_item - ) - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) - spinner.adapter = adapter + val spinner = binding.spinnerPlanTimeTrackSemester + val adapter = ArrayAdapter.createFromResource( + requireContext(), + R.array.semester_options, + android.R.layout.simple_spinner_item + ) + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) + spinner.adapter = adapter - // 선택한 항목 리스너 추가 (필요한 경우) + // 선택한 항목 리스너 추가 (필요한 경우) - spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - override fun onItemSelected( - parent: AdapterView<*>?, - view: View?, - position: Int, - id: Long - ) { - val selectedItem = parent?.getItemAtPosition(position).toString() - when (selectedItem) { - "1학년 1학기" -> { - viewModel.setGradeAndSemester(1, 1) -// viewModel.getTimeInfo(1, 1) + spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { + override fun onItemSelected( + parent: AdapterView<*>?, + view: View?, + position: Int, + id: Long + ) { + val selectedItem = parent?.getItemAtPosition(position).toString() + when (selectedItem) { + "1학년 1학기" -> { + viewModel.setGradeAndSemester(1, 1) + viewModel.getTimeInfo(1, 1) + Log.d("selected Item",selectedItem) - } + } - "1학년 2학기" -> { - viewModel.setGradeAndSemester(1, 2) -// viewModel.getTimeInfo(1, 2) + "1학년 2학기" -> { + viewModel.setGradeAndSemester(1, 2) + viewModel.getTimeInfo(1, 2) - } + } - "2학년 1학기" -> { - viewModel.setGradeAndSemester(2, 1) -// viewModel.getTimeInfo(2, 1) + "2학년 1학기" -> { + viewModel.setGradeAndSemester(2, 1) + viewModel.getTimeInfo(2, 1) - } + } - "2학년 2학기" -> { - viewModel.setGradeAndSemester(2, 2) -// viewModel.getTimeInfo(2, 2) + "2학년 2학기" -> { + viewModel.setGradeAndSemester(2, 2) + viewModel.getTimeInfo(2, 2) - } + } - "3학년 1학기" -> { - viewModel.setGradeAndSemester(3, 1) -// viewModel.getTimeInfo(3, 1) + "3학년 1학기" -> { + viewModel.setGradeAndSemester(3, 1) + viewModel.getTimeInfo(3, 1) - } + } - "3학년 2학기" -> { - viewModel.setGradeAndSemester(3, 2) + "3학년 2학기" -> { + viewModel.setGradeAndSemester(3, 2) // viewModel.getTimeInfo(3, 2) - } + } - "4학년 1학기" -> { - viewModel.setGradeAndSemester(4, 1) + "4학년 1학기" -> { + viewModel.setGradeAndSemester(4, 1) // viewModel.getTimeInfo(4, 1) - } + } - "4학년 2학기" -> { - viewModel.setGradeAndSemester(4, 2) + "4학년 2학기" -> { + viewModel.setGradeAndSemester(4, 2) // viewModel.getTimeInfo(4, 2) - } + } - } + } - } + } - override fun onNothingSelected(parent: AdapterView<*>?) { - // 아무 것도 선택되지 않은 경우의 동작 구현 - } - } - binding.timeStoreButton.setOnClickListener { - // grade와 semester가 선택되었는지 확인 - val grade = viewModel.grade.value - val semester = viewModel.semester.value + override fun onNothingSelected(parent: AdapterView<*>?) { + // 아무 것도 선택되지 않은 경우의 동작 구현 + } + } + binding.timeStoreButton.setOnClickListener { + // grade와 semester가 선택되었는지 확인 + val grade = viewModel.grade.value + val semester = viewModel.semester.value - if (grade == null || semester == null) { - // 학년 또는 학기가 선택되지 않았다면 토스트 메시지 표시 - Toast.makeText(context, "학년과 학기를 선택해주세요.", Toast.LENGTH_SHORT).show() - } else { - // 선택된 경우에만 서버로 데이터 전송 처리 - viewModel.sendAddTimeRequest() - viewModel.getTimeInfo(grade, semester) - } - } + if (grade == null || semester == null) { + // 학년 또는 학기가 선택되지 않았다면 토스트 메시지 표시 + Toast.makeText(context, "학년과 학기를 선택해주세요.", Toast.LENGTH_SHORT).show() + } else { + // 선택된 경우에만 서버로 데이터 전송 처리 + viewModel.sendAddTimeRequest() + viewModel.getTimeInfo(grade, semester) + } + } - binding.titleMoveTimetable.setOnClickListener { - navigate(R.id.action_planTimetableFragment_to_planSettingFragment) + binding.titleMoveTimetable.setOnClickListener { + navigate(R.id.action_planTimetableFragment_to_planSettingFragment) - } + } - } + } - private fun observeSelectedTimeResults() { - viewModel.selectedTimeResults.observe(viewLifecycleOwner) { selectedTimeResults -> - (binding.recyclerView.adapter as PlanTimeAdapter).updateTimeList(selectedTimeResults) - } - } + private fun observeSelectedTimeResults() { + viewModel.selectedTimeResults.observe(viewLifecycleOwner) { selectedTimeResults -> + (binding.recyclerView.adapter as PlanTimeAdapter).updateTimeList(selectedTimeResults) + } + } - // 추가하기 버튼으로 시간표에 과목 업데이트 - private fun setupRecyclerView() { - // 초기 데이터 리스트를 비어 있는 리스트로 설정합니다. - // 데이터가 준비되면, 나중에 observeSelectedTimeResults 함수 내에서 submitList를 통해 업데이트합니다. - adapter = PlanTimeAdapter(emptyList()) - binding.recyclerView.layoutManager = LinearLayoutManager(context) - binding.recyclerView.adapter = adapter - } + // 추가하기 버튼으로 시간표에 과목 업데이트 + private fun setupRecyclerView() { + // 초기 데이터 리스트를 비어 있는 리스트로 설정합니다. + // 데이터가 준비되면, 나중에 observeSelectedTimeResults 함수 내에서 submitList를 통해 업데이트합니다. + adapter = PlanTimeAdapter(emptyList()) + binding.recyclerView.layoutManager = LinearLayoutManager(context) + binding.recyclerView.adapter = adapter + } - override fun onDestroyView() { - super.onDestroyView() - _binding = null - } + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } } diff --git a/app/src/main/java/umc/com/mobile/project/ui/plan/PlanViewModel.kt b/app/src/main/java/umc/com/mobile/project/ui/plan/PlanViewModel.kt index 1d9b385..bb40ddd 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/plan/PlanViewModel.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/plan/PlanViewModel.kt @@ -26,11 +26,9 @@ import umc.com.mobile.project.data.model.plan.SemesterTimeResponse import umc.com.mobile.project.data.model.plan.SubjectDtoList import umc.com.mobile.project.data.model.plan.TimeInfoResponse - import umc.com.mobile.project.data.model.plan.TimeResult import umc.com.mobile.project.data.model.plan.UPlicenseResponse import umc.com.mobile.project.data.model.plan.UpTimeResponse - import umc.com.mobile.project.data.model.plan.upTimeResult import umc.com.mobile.project.data.network.ApiClient import umc.com.mobile.project.data.network.api.PlanApi @@ -179,12 +177,13 @@ val addTimeResponse: MutableLiveData = _addTimeResponse fun addTime(request: AddTimeRequest) { - Log.d("gradesemester", "Sending AddTimeRequest with grade: ${request.semesterDto.grade}, semester: ${request.semesterDto.semester}") + planApiService.addTime(request).enqueue(object : Callback { override fun onResponse(call: Call, response: Response) { if (response.isSuccessful) { // 서버로부터 응답을 성공적으로 받았을 때 LiveData 업데이트 Log.d("TimeTableApi", "getListTimeInfo 성공: ${response.body()}") + Log.d("gradesemester", "Sending AddTimeRequest with grade: ${request.semesterDto.grade}, semester: ${request.semesterDto.semester}") _addTimeResponse.postValue(response.body()) } else { // 에러 처리: 실패 응답 처리 @@ -340,6 +339,8 @@ } + + fun saveLicense(request: List) { planApiService.saveLicense(request).enqueue(object : Callback { @@ -453,7 +454,7 @@ }) } - fun certificateLicense(request: CertificateLicenseRequest) { + fun certificateLicense(request: List) { planApiService.certificateLicense(request).enqueue(object : Callback { override fun onResponse(call: Call, response: Response) { if (response.isSuccessful) { @@ -476,7 +477,8 @@ } - fun getTimeInfo(grade:Int,semester:Int) { + + fun getTimeInfo(grade:Int, semester:Int) { planApiService.getUptime(grade,semester).enqueue(object : Callback { override fun onResponse( call: Call, @@ -484,16 +486,18 @@ ) { if (response.isSuccessful) { if (response.body() != null) { - var timeList = response.body()!!.result - var itemList = ArrayList() - timeList.forEach{ - + val timeList = response.body()!!.result + val itemList = ArrayList() + timeList.forEach { itemList.add(TimeInfoResponse(it.type,it.name,it.credit.toString())) } - _selectedTimeResults.postValue(itemList) + _selectedTimeResults.value = itemList + + Log.d("PlanUpTime1", "TimeInfoResponse: $timeList") Log.d("PlanUpTime", "${response.body()}") } else { + Log.d("PlanUpTime", "${response.body()}") _error.postValue("서버 응답이 올바르지 않습니다.") } } else { @@ -503,18 +507,20 @@ RuntimeException(it) } ?: RuntimeException("Unknown error") } catch (e: Exception) { - Log.e("PlanUpTime", "PlanResponse API 오류: ${e.message}") + Log.e("PlanViewModel", "Failed to get time info: ${response.errorBody()?.string()}") + } } } override fun onFailure(call: Call, t: Throwable) { _error.postValue("네트워크 오류: ${t.message}") - Log.d("gradInfo", "completion: ${t.message}") + Log.d("PlanUpTime12", "Network error: ${t.message}") } }) } + fun deleteLicense(certificateId: Long) { planApiService.deleteLicense(certificateId).enqueue(object : Callback { override fun onResponse(call: Call, response: Response) { diff --git a/app/src/main/java/umc/com/mobile/project/ui/plan/PlanlicenseFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/plan/PlanlicenseFragment.kt index 662b3f8..94602da 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/plan/PlanlicenseFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/plan/PlanlicenseFragment.kt @@ -13,123 +13,181 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.fragment.app.viewModels import umc.com.mobile.project.R +import umc.com.mobile.project.data.model.plan.CertificateLicenseRequest import umc.com.mobile.project.databinding.FragmentPlanlicenseBinding class PlanlicenseFragment : Fragment() { - private var _binding: FragmentPlanlicenseBinding? = null - private val viewModel: PlanViewModel by activityViewModels() - private val binding get() = _binding!! - - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? - ): View { - _binding = FragmentPlanlicenseBinding.inflate(inflater, container, false) - - viewModel.getLicenseInfo() // api 연결 - - // UPlicenseResponse-자격증 정보 불러오기 - viewModel.licenseInfo.observe(viewLifecycleOwner) { licenseInfo -> - licenseInfo?.result?.let { resultList -> - // 첫 번째 Result 객체에 접근하여 데이터 매핑 - resultList.getOrNull(0)?.let { firstResult -> - binding.planLicenseName.setText(firstResult.name) - binding.planLicenseDate.setText(firstResult.date) - } - - // 두 번째 Result 객체에 접근하여 데이터 매핑 - resultList.getOrNull(1)?.let { secondResult -> - binding.planLicenseName2.setText(secondResult.name) - binding.planLicenseDate2.setText(secondResult.date) - - } - - resultList.getOrNull(2)?.let { thirdResult -> - binding.planLicenseName3.setText(thirdResult.name) - binding.planLicenseDate3.setText(thirdResult.date) - - - } - - resultList.getOrNull(3)?.let { fourthResult -> - binding.planLicenseName4.setText(fourthResult.name) - binding.planLicenseDate4.setText(fourthResult.date) - } - } - } - - return binding.root - } - - - private fun submitData() { - - val name = binding.planLicenseName.text.toString() - val date = binding.planLicenseDate.text.toString() - - // SaveInfo 객체 리스트 생성 - val saveInfoList = listOf(SaveInfo(name, date)) - - // SavelicenseRequest 객체 생성 - - // API 호출 - viewModel.saveLicense(saveInfoList) - - } - - - private fun setupEditTextListener() { - val textWatcher = object : TextWatcher { - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { - // 필요 없음 - } - - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { - // 입력이 변경될 때마다 호출됩니다. - checkIfAnyInputIsFilled() - } - - override fun afterTextChanged(s: Editable?) { - // 필요 없음 - } - } - binding.planLicenseName.addTextChangedListener(textWatcher) - } - - private fun checkIfAnyInputIsFilled() { - val isAnyFieldFilled = binding.planLicenseName.text.trim().isNotEmpty() - //버튼 활성화 업데이트 - binding.licenseButtonStore.isEnabled = isAnyFieldFilled - - // 버튼 색상도 업데이트 - val colorResId = if (isAnyFieldFilled) R.color.skyBlue else R.color.gray - val color = ContextCompat.getColor(requireContext(), colorResId) - binding.licenseButtonStore.backgroundTintList = ColorStateList.valueOf(color) - } - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - setupEditTextListener() - checkIfAnyInputIsFilled() // 초기 상태 확인 - binding.licenseButtonStore.setOnClickListener { - submitData() // 사용자 입력을 기반으로 API 호출 - } - binding.licenseDeleteButton.setOnClickListener { - deleteLicense() // 삭제 API 호출 - } - } + private var _binding: FragmentPlanlicenseBinding? = null + private val viewModel: PlanViewModel by activityViewModels() + private val binding get() = _binding!! + private var edit:Boolean=false - private fun deleteLicense() { - // 삭제할 자격증 ID - val certificateId = 1 // 예시로 1을 사용하였습니다. 실제로는 삭제할 자격증의 ID를 전달해야 합니다. + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = FragmentPlanlicenseBinding.inflate(inflater, container, false) + binding.licenseCertificateButton.setOnClickListener { + if(edit){ + var licenseList=ArrayList() // 빈 배열만듦 + viewModel.licenseInfo.value?.result?.get(0)?.certificateId?.let { it1 -> + CertificateLicenseRequest( + it1, + binding.planLicenseName.text.toString(),binding.planLicenseDate.text.toString()) + }?.let { it2 -> licenseList.add(it2) } - // API 호출 + viewModel.licenseInfo.value?.result?.get(1)?.certificateId?.let { it1 -> + CertificateLicenseRequest( + it1, + binding.planLicenseName2.text.toString(),binding.planLicenseDate2.text.toString()) + }?.let { it2 -> licenseList.add(it2) } + + + viewModel.licenseInfo.value?.result?.get(2)?.certificateId?.let { it1 -> + CertificateLicenseRequest( + it1, + binding.planLicenseName3.text.toString(),binding.planLicenseDate3.text.toString()) + }?.let { it2 -> licenseList.add(it2) } + + viewModel.licenseInfo.value?.result?.get(3)?.certificateId?.let { it1 -> + CertificateLicenseRequest( + it1, + binding.planLicenseName4.text.toString(),binding.planLicenseDate4.text.toString()) + }?.let { it2 -> licenseList.add(it2) } + + + + + + viewModel.certificateLicense(licenseList) + + + } + } + + + + viewModel.getLicenseInfo() // api 연결 + + + + + // UPlicenseResponse-자격증 정보 불러오기 + viewModel.licenseInfo.observe(viewLifecycleOwner) { licenseInfo -> + licenseInfo?.result?.let { resultList -> + if (resultList.isNotEmpty()) { + resultList.forEachIndexed { index, result -> + when (index) { + 0 -> { + binding.planLicenseName.setText(result.name) + binding.planLicenseDate.setText(result.date) + + } + 1 -> { + binding.planLicenseName2.setText(result.name) + binding.planLicenseDate2.setText(result.date) + + } + 2 -> { + binding.planLicenseName3.setText(result.name) + binding.planLicenseDate3.setText(result.date) + + } + 3 -> { + binding.planLicenseName4.setText(result.name) + binding.planLicenseDate4.setText(result.date) + + } + } + } + setupEditTextListeners() + } + } + } + + return binding.root + } + + + private fun submitData() { + + val name = binding.planLicenseName.text.toString() + val date = binding.planLicenseDate.text.toString() + + // SaveInfo 객체 리스트 생성 + val saveInfoList = listOf(SaveInfo(name, date)) + + // SavelicenseRequest 객체 생성 + + + // API 호출 + viewModel.saveLicense(saveInfoList) + + } + + + + private fun setupEditTextListeners() { + + binding.planLicenseName.addTextChangedListener(createTextWatcher()) + binding.planLicenseName2.addTextChangedListener(createTextWatcher()) + binding.planLicenseName3.addTextChangedListener(createTextWatcher()) + binding.planLicenseName4.addTextChangedListener(createTextWatcher()) + } + private fun createTextWatcher(): TextWatcher { + return object : TextWatcher { + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + edit=true + + } + override fun afterTextChanged(s: Editable?) {} + } + } + private fun checkIfAnyInputIsFilled() { + val isAnyFieldFilled = binding.planLicenseName.text.trim().isNotEmpty() + //버튼 활성화 업데이트 + binding.licenseButtonStore.isEnabled = isAnyFieldFilled + + // 버튼 색상도 업데이트 + val colorResId = if (isAnyFieldFilled) R.color.skyBlue else R.color.gray + val color = ContextCompat.getColor(requireContext(), colorResId) + binding.licenseButtonStore.backgroundTintList = ColorStateList.valueOf(color) + + + + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + setupEditTextListeners() + checkIfAnyInputIsFilled() // 초기 상태 확인 + binding.licenseButtonStore.setOnClickListener { + submitData() // 사용자 입력을 기반으로 API 호출 + } + + + + + + + + + + + + } + private fun deleteLicense() { + // 삭제할 자격증 ID + val certificateId = 1 // 예시로 1을 사용하였습니다. 실제로는 삭제할 자격증의 ID를 전달해야 합니다. + + // API 호출 // viewModel.deleteLicense(certificateId) - } + } - override fun onDestroyView() { - super.onDestroyView() - _binding = null - } + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_planlicense.xml b/app/src/main/res/layout/fragment_planlicense.xml index 2135eaa..5427497 100644 --- a/app/src/main/res/layout/fragment_planlicense.xml +++ b/app/src/main/res/layout/fragment_planlicense.xml @@ -5,12 +5,10 @@ xmlns:tools="http://schemas.android.com/tools"> - - @@ -19,15 +17,15 @@ android:id="@+id/license_const_layout" android:layout_width="322dp" android:layout_height="223dp" - android:layout_marginTop="29dp" android:background="@drawable/rectangle_4257" - android:paddingLeft="8dp" - android:paddingTop="10dp" - android:paddingRight="9dp" - android:paddingBottom="10dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" + android:paddingTop="10dp" + android:paddingLeft="8dp" + android:paddingRight="9dp" + android:paddingBottom="10dp" + android:layout_marginTop="29dp" > @@ -38,29 +36,29 @@ android:background="@drawable/edittext_rounded_line" android:padding="16dp" app:columnCount="2" - app:layout_constraintEnd_toEndOf="@id/license_const_layout" - app:layout_constraintStart_toStartOf="@id/license_const_layout" - app:layout_constraintTop_toTopOf="@id/license_const_layout" app:rowCount="5" + app:layout_constraintTop_toTopOf="@id/license_const_layout" + app:layout_constraintStart_toStartOf="@id/license_const_layout" + app:layout_constraintEnd_toEndOf="@id/license_const_layout" tools:layout_editor_absoluteX="11dp" tools:layout_editor_absoluteY="4dp"> + app:layout_rowWeight="1" + /> + app:layout_rowWeight="1" + android:gravity="center" + android:maxLength="9" + android:maxLines="1" + /> + app:layout_rowWeight="1" + android:gravity="center" + + /> + app:layout_rowWeight="1" + android:gravity="center"/> + app:layout_rowWeight="1" + android:gravity="center"/> + app:layout_rowWeight="1" + android:gravity="center"/> + app:layout_rowWeight="1" + android:gravity="center"/> + app:layout_rowWeight="1" + android:gravity="center"/> + app:layout_rowWeight="1" + android:gravity="center"/> @@ -173,42 +177,39 @@ - - + + + /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d66f3e2..7e8144e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,6 +26,9 @@ 4학년 2학기 + 저장하기 + 수정하기 + 졸업 예정일 0000년 00월 00일