From 461755f6dfa1f31076976eaa3d2b5cef864c828e Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 20 Apr 2024 01:57:30 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=B0=9C=ED=96=89=20=EB=B0=8F=20?= =?UTF-8?q?=EC=BD=A4=EB=A7=88=20=EC=B6=94=EA=B0=80,=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20import=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/MedicalRecordAddFragment.kt | 36 +++++++++++-------- .../viewmodel/MedicalRecordViewModel.kt | 9 ----- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/com/project/meongcare/medicalRecord/view/MedicalRecordAddFragment.kt b/app/src/main/java/com/project/meongcare/medicalRecord/view/MedicalRecordAddFragment.kt index 5340577d..3fc8d345 100644 --- a/app/src/main/java/com/project/meongcare/medicalRecord/view/MedicalRecordAddFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalRecord/view/MedicalRecordAddFragment.kt @@ -13,19 +13,13 @@ import android.widget.EditText import android.widget.TextView import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat -import androidx.core.widget.addTextChangedListener import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.viewModels import androidx.navigation.fragment.findNavController import com.bumptech.glide.Glide -import com.project.meongcare.BuildConfig import com.project.meongcare.MainActivity import com.project.meongcare.R -import com.project.meongcare.aws.util.AWSS3ImageUtils -import com.project.meongcare.aws.util.PARENT_FOLDER_PATH -import com.project.meongcare.aws.util.SUPPLEMENTS_FOLDER_PATH -import com.project.meongcare.aws.viewmodel.AWSS3ViewModel import com.project.meongcare.databinding.FragmentMedicalRecordAddBinding import com.project.meongcare.medicalRecord.model.data.local.OnPictureChangedListener import com.project.meongcare.medicalRecord.model.utils.MedicalRecordUtils @@ -34,10 +28,6 @@ import com.project.meongcare.medicalRecord.view.bottomSheet.MedicalRecordPicture import com.project.meongcare.medicalRecord.viewmodel.MedicalRecordViewModel import com.project.meongcare.snackbar.view.CustomSnackBar import dagger.hilt.android.AndroidEntryPoint -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import java.io.File import java.time.LocalDate import java.time.format.DateTimeFormatter @@ -165,7 +155,7 @@ class MedicalRecordAddFragment : } } - fun isEditTextNullOrEmpty( + private fun isEditTextNullOrEmpty( editText: EditText, layout: ConstraintLayout?, textCount: TextView, @@ -212,11 +202,27 @@ class MedicalRecordAddFragment : setEditTextWatcher(editText, count, R.string.medicalrecord_hospital_name_length) } - private fun setEditTextWatcher(editText: EditText, count: TextView, stringId: Int) { + private fun setEditTextWatcher( + editText: EditText, + count: TextView, + stringId: Int + ) { editText.addTextChangedListener(object : TextWatcher { - override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + override fun beforeTextChanged( + p0: CharSequence?, + p1: Int, + p2: Int, + p3: Int, + ) { + } - override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + override fun onTextChanged( + p0: CharSequence?, + p1: Int, + p2: Int, + p3: Int, + ) { + } override fun afterTextChanged(p0: Editable?) { count.text = @@ -265,7 +271,7 @@ class MedicalRecordAddFragment : ) } - fun showCalendarBottomSheet( + private fun showCalendarBottomSheet( parentFragmentManager: FragmentManager, onDateSelectedListener: MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener, ) { diff --git a/app/src/main/java/com/project/meongcare/medicalRecord/viewmodel/MedicalRecordViewModel.kt b/app/src/main/java/com/project/meongcare/medicalRecord/viewmodel/MedicalRecordViewModel.kt index 8a7693a2..79399d9b 100644 --- a/app/src/main/java/com/project/meongcare/medicalRecord/viewmodel/MedicalRecordViewModel.kt +++ b/app/src/main/java/com/project/meongcare/medicalRecord/viewmodel/MedicalRecordViewModel.kt @@ -6,10 +6,6 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.project.meongcare.aws.util.AWSS3ImageUtils -import com.project.meongcare.aws.util.PARENT_FOLDER_PATH -import com.project.meongcare.aws.util.SUPPLEMENTS_FOLDER_PATH -import com.project.meongcare.login.model.data.local.UserPreferences import com.project.meongcare.login.view.GlobalApplication import com.project.meongcare.medicalRecord.model.data.repository.MedicalRecordRepositoryImpl import com.project.meongcare.medicalRecord.model.entities.MedicalRecordDto @@ -17,13 +13,8 @@ import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGetResponse import com.project.meongcare.medicalRecord.model.entities.RequestMedicalRecord import com.project.meongcare.medicalRecord.model.utils.MedicalRecordUtils -import com.project.meongcare.supplement.model.entities.SupplementPostRequest import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody import retrofit2.Response import javax.inject.Inject