diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditActivityFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditActivityFragment.kt index 71944ea3..e92bedfb 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditActivityFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditActivityFragment.kt @@ -75,6 +75,7 @@ class CareerEditActivityFragment : Fragment() { if (isDeleted) { //삭제 작업이 완료되면 목록 업데이트 navigate(R.id.action_fragment_edit_activity_to_fragment_career_activity) + Toast.makeText(mContext, "삭제되었습니다.", Toast.LENGTH_SHORT).show() } }) } @@ -84,6 +85,7 @@ class CareerEditActivityFragment : Fragment() { if (isUpdated) { //수정 작업이 완료되면 목록 업데이트 navigate(R.id.action_fragment_edit_activity_to_fragment_career_activity) + Toast.makeText(mContext, "수정되었습니다.", Toast.LENGTH_SHORT).show() } }) } @@ -101,7 +103,7 @@ class CareerEditActivityFragment : Fragment() { } }) //버튼 활성화 - viewModel.isFilledAllOptions.observe(viewLifecycleOwner) { isEnabled -> + viewModel.isFilledAnyOptions.observe(viewLifecycleOwner) { isEnabled -> binding?.btnCareerEdit?.isEnabled = isEnabled binding?.btnCareerEdit?.backgroundTintList = ContextCompat.getColorStateList( diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditCertificateFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditCertificateFragment.kt index 3bb63d00..07e06f02 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditCertificateFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditCertificateFragment.kt @@ -6,6 +6,7 @@ import android.text.Editable import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.Toast import androidx.core.content.ContextCompat import androidx.fragment.app.DialogFragment import androidx.fragment.app.Fragment @@ -64,6 +65,7 @@ class CareerEditCertificateFragment : Fragment() { if (isDeleted) { //삭제 작업이 완료되면 목록 업데이트 navigate(R.id.action_fragment_edit_certificate_to_fragment_career_certificate) + Toast.makeText(mContext, "삭제되었습니다.", Toast.LENGTH_SHORT).show() } }) } @@ -74,6 +76,7 @@ class CareerEditCertificateFragment : Fragment() { if (isUpdated) { //수정 작업이 완료되면 목록 업데이트 navigate(R.id.action_fragment_edit_certificate_to_fragment_career_certificate) + Toast.makeText(mContext, "수정되었습니다.", Toast.LENGTH_SHORT).show() } }) } diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditContestFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditContestFragment.kt index 73220b84..cd461105 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditContestFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditContestFragment.kt @@ -6,6 +6,7 @@ import android.text.Editable import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.Toast import androidx.core.content.ContextCompat import androidx.fragment.app.DialogFragment import androidx.fragment.app.Fragment @@ -72,6 +73,7 @@ class CareerEditContestFragment : Fragment() { if (isDeleted) { //삭제 작업이 완료되면 목록 업데이트 navigate(R.id.action_fragment_edit_contest_to_fragment_career_contest) + Toast.makeText(mContext, "삭제되었습니다.", Toast.LENGTH_SHORT).show() } }) } @@ -81,6 +83,7 @@ class CareerEditContestFragment : Fragment() { if (isUpdated) { //수정 작업이 완료되면 목록 업데이트 navigate(R.id.action_fragment_edit_contest_to_fragment_career_contest) + Toast.makeText(mContext, "수정되었습니다.", Toast.LENGTH_SHORT).show() } }) } diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditVolunteerFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditVolunteerFragment.kt index 7e337798..0cb729fe 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditVolunteerFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/CareerEditVolunteerFragment.kt @@ -6,6 +6,7 @@ import android.text.Editable import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.Toast import androidx.core.content.ContextCompat import androidx.fragment.app.DialogFragment import androidx.fragment.app.Fragment @@ -63,6 +64,7 @@ class CareerEditVolunteerFragment : Fragment() { if (isDeleted) { //삭제 작업이 완료되면 목록 업데이트 navigate(R.id.action_fragment_edit_volunteer_to_fragment_career_volunteer) + Toast.makeText(mContext, "삭제되었습니다.", Toast.LENGTH_SHORT).show() } }) } @@ -72,6 +74,7 @@ class CareerEditVolunteerFragment : Fragment() { if (isUpdated) { //수정 작업이 완료되면 목록 업데이트 navigate(R.id.action_fragment_edit_volunteer_to_fragment_career_volunteer) + Toast.makeText(mContext, "수정되었습니다.", Toast.LENGTH_SHORT).show() } }) } diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerAddCertificateViewModel.kt b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerAddCertificateViewModel.kt index c7118178..5bbe3c3d 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerAddCertificateViewModel.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerAddCertificateViewModel.kt @@ -48,14 +48,14 @@ class CareerAddCertificateViewModel : ViewModel() { /* 버튼 활성화 기능 */ val isFilledAllOptions: LiveData = MediatorLiveData().apply { addSource(title) { value = areBothFieldsFilled() } + addSource(selectedCertificateType) { value = areBothFieldsFilled() } addSource(startDate) { value = areBothFieldsFilled() } addSource(endDate) { value = areBothFieldsFilled() } } private fun areBothFieldsFilled(): Boolean { - return !(title.value.isNullOrEmpty() || title.value!!.contains(" ") || title.value!!.length > 20) && isDateValid( - startDate.value - ) && isDateValid(endDate.value) + return !(title.value.isNullOrEmpty() || title.value!!.contains(" ") || title.value!!.length > 20) && !selectedCertificateType.value.isNullOrEmpty() + && isDateValid(startDate.value) && isDateValid(endDate.value) } private fun isDateValid(date: String?): Boolean { diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerAddContestViewModel.kt b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerAddContestViewModel.kt index efce1bc7..4acb3157 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerAddContestViewModel.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerAddContestViewModel.kt @@ -48,14 +48,14 @@ class CareerAddContestViewModel : ViewModel() { /* 버튼 활성화 기능 */ val isFilledAllOptions: LiveData = MediatorLiveData().apply { addSource(title) { value = areBothFieldsFilled() } + addSource(selectedAward) { value = areBothFieldsFilled() } addSource(startDate) { value = areBothFieldsFilled() } addSource(endDate) { value = areBothFieldsFilled() } } private fun areBothFieldsFilled(): Boolean { - return !(title.value.isNullOrEmpty() || title.value!!.contains(" ") || title.value!!.length > 20) && isDateValid( - startDate.value - ) && isDateValid(endDate.value) + return !(title.value.isNullOrEmpty() || title.value!!.contains(" ") || title.value!!.length > 20) && !selectedAward.value.isNullOrEmpty() + && isDateValid(startDate.value) && isDateValid(endDate.value) } private fun isDateValid(date: String?): Boolean { diff --git a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditActivityViewModel.kt b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditActivityViewModel.kt index 49655c62..3b577c6e 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditActivityViewModel.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/career/viewmodel/CareerEditActivityViewModel.kt @@ -33,6 +33,9 @@ class CareerEditActivityViewModel : ViewModel() { val endDate: MutableLiveData = MutableLiveData() val fileAddedEvent: MutableLiveData = MutableLiveData() val addFiles: MutableList = mutableListOf() + val addFilesLive: MutableLiveData = MutableLiveData().apply { + value = addFiles.isNotEmpty() + } init { studentId.value = 0 @@ -49,18 +52,19 @@ class CareerEditActivityViewModel : ViewModel() { startDate.value = "" endDate.value = "" addFiles.clear() + addFilesLive.value = addFiles.isNotEmpty() } - val isFilledAllOptions: LiveData = MediatorLiveData().apply { - value = areBothFieldsFilled() - addSource(startDate) { value = areBothFieldsFilled() } - addSource(endDate) { value = areBothFieldsFilled() } + val isFilledAnyOptions: LiveData = MediatorLiveData().apply { + value = isAnyFieldFilled() + addSource(title) { value = isAnyFieldFilled() } + addSource(startDate) { value = isAnyFieldFilled() } + addSource(endDate) { value = isAnyFieldFilled() } + addSource(addFilesLive) { value = isAnyFieldFilled() } } - private fun areBothFieldsFilled(): Boolean { - return (startDate.value.isNullOrBlank() && endDate.value.isNullOrBlank()) || (isDateValid( - startDate.value - ) && isDateValid(endDate.value)) + private fun isAnyFieldFilled(): Boolean { + return !title.value.isNullOrBlank() || !startDate.value.isNullOrBlank() || !endDate.value.isNullOrBlank() || (addFilesLive.value ?: false) } private fun isDateValid(date: String?): Boolean { @@ -71,6 +75,7 @@ class CareerEditActivityViewModel : ViewModel() { val requestFile = RequestBody.create("image/*".toMediaTypeOrNull(), file) val body = MultipartBody.Part.createFormData("addFiles", file.name, requestFile) addFiles.add(body) + addFilesLive.value = addFiles.isNotEmpty() fileAddedEvent.value = true } @@ -99,6 +104,7 @@ class CareerEditActivityViewModel : ViewModel() { val requestFile: RequestBody = RequestBody.create(mimeType?.toMediaTypeOrNull(), file) val filePart = MultipartBody.Part.createFormData("addFiles", fileName, requestFile) addFiles.add(filePart) + addFilesLive.value = addFiles.isNotEmpty() fileAddedEvent.value = true } 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 3af5d61d..20f51d07 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 @@ -44,17 +44,17 @@ class CareerEditCertificateViewModel : ViewModel() { startDate.value = "" endDate.value = "" } - + val isFilledAllOptions: LiveData = MediatorLiveData().apply { - value = areBothFieldsFilled() - addSource(startDate) { value = areBothFieldsFilled() } - addSource(endDate) { value = areBothFieldsFilled() } + value = isAnyFieldFilled() + addSource(title) { value = isAnyFieldFilled() } + addSource(type) { value = isAnyFieldFilled() } + addSource(startDate) { value = isAnyFieldFilled() } + addSource(endDate) { value = isAnyFieldFilled() } } - private fun areBothFieldsFilled(): Boolean { - return (startDate.value.isNullOrBlank() && endDate.value.isNullOrBlank()) || (isDateValid( - startDate.value - ) && isDateValid(endDate.value)) + private fun isAnyFieldFilled(): Boolean { + return !title.value.isNullOrBlank() || !type.value.isNullOrBlank() || !startDate.value.isNullOrBlank() || !endDate.value.isNullOrBlank() } private fun isDateValid(date: String?): Boolean { 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 dc668e9a..8bd6c799 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 @@ -46,15 +46,15 @@ class CareerEditContestViewModel : ViewModel() { } val isFilledAllOptions: LiveData = MediatorLiveData().apply { - value = areBothFieldsFilled() - addSource(startDate) { value = areBothFieldsFilled() } - addSource(endDate) { value = areBothFieldsFilled() } + value = isAnyFieldFilled() + addSource(title) { value = isAnyFieldFilled() } + addSource(award) { value = isAnyFieldFilled() } + addSource(startDate) { value = isAnyFieldFilled() } + addSource(endDate) { value = isAnyFieldFilled() } } - private fun areBothFieldsFilled(): Boolean { - return (startDate.value.isNullOrBlank() && endDate.value.isNullOrBlank()) || (isDateValid( - startDate.value - ) && isDateValid(endDate.value)) + private fun isAnyFieldFilled(): Boolean { + return !title.value.isNullOrBlank() || !award.value.isNullOrBlank() || !startDate.value.isNullOrBlank() || !endDate.value.isNullOrBlank() } private fun isDateValid(date: String?): Boolean { 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 c8ecee88..07fcccae 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 @@ -46,15 +46,15 @@ class CareerEditVolunteerViewModel : ViewModel() { } val isFilledAllOptions: LiveData = MediatorLiveData().apply { - value = areBothFieldsFilled() - addSource(startDate) { value = areBothFieldsFilled() } - addSource(endDate) { value = areBothFieldsFilled() } + value = isAnyFieldFilled() + addSource(title) { value = isAnyFieldFilled() } + addSource(hour) { value = isAnyFieldFilled() } + addSource(startDate) { value = isAnyFieldFilled() } + addSource(endDate) { value = isAnyFieldFilled() } } - private fun areBothFieldsFilled(): Boolean { - return (startDate.value.isNullOrBlank() && endDate.value.isNullOrBlank()) || (isDateValid( - startDate.value - ) && isDateValid(endDate.value)) + private fun isAnyFieldFilled(): Boolean { + return !title.value.isNullOrBlank() || !hour.value.isNullOrBlank() || !startDate.value.isNullOrBlank() || !endDate.value.isNullOrBlank() } private fun isDateValid(date: String?): Boolean { diff --git a/app/src/main/res/layout/fragment_career_add_activity.xml b/app/src/main/res/layout/fragment_career_add_activity.xml index 45dc7b51..c3426ce8 100644 --- a/app/src/main/res/layout/fragment_career_add_activity.xml +++ b/app/src/main/res/layout/fragment_career_add_activity.xml @@ -105,6 +105,7 @@ android:focusable="false" android:gravity="top" android:hint="@string/career_date_ex" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -137,6 +138,7 @@ android:focusable="false" android:gravity="top" android:hint="@string/career_date_ex" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="10dp" android:paddingBottom="10dp" diff --git a/app/src/main/res/layout/fragment_career_add_certificate.xml b/app/src/main/res/layout/fragment_career_add_certificate.xml index 2f325943..859afc0c 100644 --- a/app/src/main/res/layout/fragment_career_add_certificate.xml +++ b/app/src/main/res/layout/fragment_career_add_certificate.xml @@ -72,6 +72,7 @@ android:focusable="false" android:gravity="top" android:hint="실기" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -103,6 +104,7 @@ android:focusable="false" android:gravity="top" android:hint="@string/career_date_ex" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -135,6 +137,7 @@ android:focusable="false" android:gravity="top" android:hint="@string/career_date_ex" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="10dp" android:paddingBottom="10dp" diff --git a/app/src/main/res/layout/fragment_career_add_contest.xml b/app/src/main/res/layout/fragment_career_add_contest.xml index 8b5dc37c..ec416cad 100644 --- a/app/src/main/res/layout/fragment_career_add_contest.xml +++ b/app/src/main/res/layout/fragment_career_add_contest.xml @@ -72,6 +72,7 @@ android:focusable="false" android:gravity="top" android:hint="@string/career_choose" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -103,6 +104,7 @@ android:focusable="false" android:gravity="top" android:hint="@string/career_date_ex" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -135,6 +137,7 @@ android:focusable="false" android:gravity="top" android:hint="@string/career_date_ex" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="10dp" android:paddingBottom="10dp" diff --git a/app/src/main/res/layout/fragment_career_add_volunteer.xml b/app/src/main/res/layout/fragment_career_add_volunteer.xml index 7f2cfd7d..4e969d16 100644 --- a/app/src/main/res/layout/fragment_career_add_volunteer.xml +++ b/app/src/main/res/layout/fragment_career_add_volunteer.xml @@ -104,6 +104,7 @@ android:focusable="false" android:gravity="top" android:hint="@string/career_date_ex" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -136,6 +137,7 @@ android:focusable="false" android:gravity="top" android:hint="@string/career_date_ex" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="10dp" android:paddingBottom="10dp" diff --git a/app/src/main/res/layout/fragment_career_edit_activity.xml b/app/src/main/res/layout/fragment_career_edit_activity.xml index d45caa2b..d92c1fa7 100644 --- a/app/src/main/res/layout/fragment_career_edit_activity.xml +++ b/app/src/main/res/layout/fragment_career_edit_activity.xml @@ -174,6 +174,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -206,6 +207,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="10dp" android:paddingBottom="10dp" diff --git a/app/src/main/res/layout/fragment_career_edit_certificate.xml b/app/src/main/res/layout/fragment_career_edit_certificate.xml index b4e21539..aff6d4bd 100644 --- a/app/src/main/res/layout/fragment_career_edit_certificate.xml +++ b/app/src/main/res/layout/fragment_career_edit_certificate.xml @@ -128,6 +128,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -159,6 +160,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -191,6 +193,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="10dp" android:paddingBottom="10dp" diff --git a/app/src/main/res/layout/fragment_career_edit_contest.xml b/app/src/main/res/layout/fragment_career_edit_contest.xml index 02f5b418..75bced7b 100644 --- a/app/src/main/res/layout/fragment_career_edit_contest.xml +++ b/app/src/main/res/layout/fragment_career_edit_contest.xml @@ -128,6 +128,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -159,6 +160,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -191,6 +193,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="10dp" android:paddingBottom="10dp" diff --git a/app/src/main/res/layout/fragment_career_edit_volunteer.xml b/app/src/main/res/layout/fragment_career_edit_volunteer.xml index 1885daba..5b8b17bb 100644 --- a/app/src/main/res/layout/fragment_career_edit_volunteer.xml +++ b/app/src/main/res/layout/fragment_career_edit_volunteer.xml @@ -160,6 +160,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="11dp" android:paddingBottom="10dp" @@ -192,6 +193,7 @@ android:focusable="false" android:gravity="top" android:hint="" + android:inputType="none" android:paddingStart="18dp" android:paddingTop="10dp" android:paddingBottom="10dp"