diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/ActivityFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/ActivityFragment.kt index 5a53720..50d5d1e 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/ActivityFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/ActivityFragment.kt @@ -6,6 +6,7 @@ import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.activity.OnBackPressedCallback import androidx.fragment.app.activityViewModels import androidx.fragment.app.viewModels import androidx.lifecycle.Observer @@ -68,6 +69,13 @@ class ActivityFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + //뒤로가기 버튼 눌렀을 때 + val callback = object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + navigate(R.id.action_fragment_activity_to_fragment_career) + } + } + requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback) //대외 활동 api 연결 viewModel.getActivityInfo() } diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CareerFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CareerFragment.kt index b937b94..a7fe5e4 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/CareerFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/CareerFragment.kt @@ -5,6 +5,7 @@ import android.text.Editable import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.activity.OnBackPressedCallback import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import umc.com.mobile.project.R diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CertificateFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CertificateFragment.kt index 8d815a8..f1331dc 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/CertificateFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/CertificateFragment.kt @@ -7,6 +7,7 @@ import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.activity.OnBackPressedCallback import androidx.fragment.app.activityViewModels import androidx.fragment.app.viewModels import androidx.lifecycle.Observer @@ -60,7 +61,6 @@ class CertificateFragment : Fragment() { false // 그 외의 경우 이벤트 소비하지 않음 } } - _binding!!.ivCareerCertificateBack.setOnClickListener { navigate(R.id.action_fragment_certificate_to_fragment_career) } @@ -69,6 +69,13 @@ class CertificateFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + //뒤로가기 버튼 눌렀을 때 + val callback = object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + navigate(R.id.action_fragment_certificate_to_fragment_career) + } + } + requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback) //자격증 목록 api 연결 viewModel.getCertificateInfo() } diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/ContestFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/ContestFragment.kt index 91a95d2..bf94711 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/ContestFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/ContestFragment.kt @@ -6,6 +6,7 @@ import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.activity.OnBackPressedCallback import androidx.fragment.app.activityViewModels import androidx.fragment.app.viewModels import androidx.lifecycle.Observer @@ -53,6 +54,13 @@ class ContestFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + //뒤로가기 버튼 눌렀을 때 + val callback = object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + navigate(R.id.action_fragment_contest_to_fragment_career) + } + } + requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback) //공모전 목록 api 연결 viewModel.getContestInfo() // adapter 초기화 diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/VolunteerFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/VolunteerFragment.kt index e79cc1f..78f027d 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/VolunteerFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/VolunteerFragment.kt @@ -6,6 +6,7 @@ import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.activity.OnBackPressedCallback import androidx.fragment.app.activityViewModels import androidx.fragment.app.viewModels import androidx.lifecycle.Observer @@ -71,6 +72,13 @@ class VolunteerFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + //뒤로가기 버튼 눌렀을 때 + val callback = object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + navigate(R.id.action_fragment_volunteer_to_fragment_career) + } + } + requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback) //봉사 활동 목록 api 연결 viewModel.getVolunteerInfo() } diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditCertificateViewModel.kt b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditCertificateViewModel.kt index 20f51d0..4b6f3e4 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditCertificateViewModel.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditCertificateViewModel.kt @@ -57,10 +57,6 @@ class CareerEditCertificateViewModel : ViewModel() { return !title.value.isNullOrBlank() || !type.value.isNullOrBlank() || !startDate.value.isNullOrBlank() || !endDate.value.isNullOrBlank() } - private fun isDateValid(date: String?): Boolean { - return date.isNullOrBlank() || date.length == 8 - } - fun updateCertificateType(selectedType: String) { type.value = selectedType } diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditContestViewModel.kt b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditContestViewModel.kt index 8bd6c79..0083373 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditContestViewModel.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditContestViewModel.kt @@ -57,10 +57,6 @@ class CareerEditContestViewModel : ViewModel() { return !title.value.isNullOrBlank() || !award.value.isNullOrBlank() || !startDate.value.isNullOrBlank() || !endDate.value.isNullOrBlank() } - private fun isDateValid(date: String?): Boolean { - return date.isNullOrBlank() || date.length == 8 - } - fun updateSelectedAward(selectedAward: String) { award.value = selectedAward } diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditVolunteerViewModel.kt b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditVolunteerViewModel.kt index 07fccca..cad2f85 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditVolunteerViewModel.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditVolunteerViewModel.kt @@ -57,10 +57,6 @@ class CareerEditVolunteerViewModel : ViewModel() { return !title.value.isNullOrBlank() || !hour.value.isNullOrBlank() || !startDate.value.isNullOrBlank() || !endDate.value.isNullOrBlank() } - private fun isDateValid(date: String?): Boolean { - return date.isNullOrBlank() || date.length == 8 - } - private val careerApiService = ApiClient.createService() private val _volunteerDetailInfo: MutableLiveData = MutableLiveData()