From d081a8af98bb02c07bac885bf274d2f40b46b030 Mon Sep 17 00:00:00 2001 From: iiolo Date: Fri, 8 Mar 2024 04:02:56 +0900 Subject: [PATCH 01/33] =?UTF-8?q?feat:=20=EC=A7=84=EB=A3=8C=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=A0=95=EB=B3=B4=20=ED=99=94=EB=A9=B4=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meongcare/MedicalRecordInfoFragment.kt | 21 ++ .../layout/fragment_medical_record_info.xml | 315 ++++++++++++++++++ 2 files changed, 336 insertions(+) create mode 100644 app/src/main/java/com/project/meongcare/MedicalRecordInfoFragment.kt create mode 100644 app/src/main/res/layout/fragment_medical_record_info.xml diff --git a/app/src/main/java/com/project/meongcare/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/MedicalRecordInfoFragment.kt new file mode 100644 index 00000000..2ca00573 --- /dev/null +++ b/app/src/main/java/com/project/meongcare/MedicalRecordInfoFragment.kt @@ -0,0 +1,21 @@ +package com.project.meongcare + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import com.project.meongcare.databinding.FragmentMedicalRecordInfoBinding + +class MedicalRecordInfoFragment : Fragment() { + private lateinit var binding: FragmentMedicalRecordInfoBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle?, + ): View { + binding = FragmentMedicalRecordInfoBinding.inflate(inflater) + return binding.root + } +} diff --git a/app/src/main/res/layout/fragment_medical_record_info.xml b/app/src/main/res/layout/fragment_medical_record_info.xml new file mode 100644 index 00000000..2d9f0d5d --- /dev/null +++ b/app/src/main/res/layout/fragment_medical_record_info.xml @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 9b7dcf6d00d3f280f54c7d50ae5bfbcb9279222d Mon Sep 17 00:00:00 2001 From: iiolo Date: Fri, 8 Mar 2024 04:11:08 +0900 Subject: [PATCH 02/33] =?UTF-8?q?design:=20=EC=A7=84=EB=A3=8C=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=82=AC=EC=A7=84=20=EC=95=84=EC=9D=B4=EC=BD=98=20?= =?UTF-8?q?=ED=81=AC=EA=B8=B0=20=EC=A1=B0=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../drawable/medical_record_add_carrier.xml | 4 +- .../layout/fragment_medical_record_info.xml | 37 +++++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/app/src/main/res/drawable/medical_record_add_carrier.xml b/app/src/main/res/drawable/medical_record_add_carrier.xml index d48492ee..3c53435f 100644 --- a/app/src/main/res/drawable/medical_record_add_carrier.xml +++ b/app/src/main/res/drawable/medical_record_add_carrier.xml @@ -1,6 +1,6 @@ - - - + android:layout_gravity="center" + android:gravity="center" + android:orientation="vertical"> + + + + + From 19f2d7fda99b5086fa271529a1c2f47ace785d60 Mon Sep 17 00:00:00 2001 From: iiolo Date: Fri, 8 Mar 2024 04:23:06 +0900 Subject: [PATCH 03/33] =?UTF-8?q?design:=20=EC=BA=98=EB=A6=B0=EB=8D=94=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=EC=BD=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/fragment_medical_record_info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/fragment_medical_record_info.xml b/app/src/main/res/layout/fragment_medical_record_info.xml index 49a78871..663366f4 100644 --- a/app/src/main/res/layout/fragment_medical_record_info.xml +++ b/app/src/main/res/layout/fragment_medical_record_info.xml @@ -152,7 +152,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="16dp" - android:src="@drawable/all_calendar" + android:src="@drawable/all_calendar_gray4" app:layout_constraintBottom_toBottomOf="@id/textvuew_medicalrecordinfo_select_date" app:layout_constraintEnd_toEndOf="@id/textvuew_medicalrecordinfo_select_date" app:layout_constraintTop_toTopOf="@id/textvuew_medicalrecordinfo_select_date" /> From 3bec5490d4c7845da50e2c62630637df9357f24f Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 9 Mar 2024 17:37:00 +0900 Subject: [PATCH 04/33] =?UTF-8?q?feat:=20=ED=82=A4=20=ED=95=B4=EC=89=AC=20?= =?UTF-8?q?=EA=B0=92=20=EA=B5=AC=ED=95=98=EB=8A=94=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/meongcare/login/view/GlobalApplication.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/com/project/meongcare/login/view/GlobalApplication.kt b/app/src/main/java/com/project/meongcare/login/view/GlobalApplication.kt index edb9f8c7..7c31dfaf 100644 --- a/app/src/main/java/com/project/meongcare/login/view/GlobalApplication.kt +++ b/app/src/main/java/com/project/meongcare/login/view/GlobalApplication.kt @@ -2,10 +2,12 @@ package com.project.meongcare.login.view import android.app.Application import android.content.Context +import android.util.Log import androidx.datastore.core.DataStore import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.preferencesDataStore import com.kakao.sdk.common.KakaoSdk +import com.kakao.sdk.common.util.Utility import com.navercorp.nid.NaverIdLoginSDK import com.project.meongcare.BuildConfig import dagger.hilt.android.HiltAndroidApp @@ -33,6 +35,9 @@ class GlobalApplication : Application() { override fun onCreate() { super.onCreate() + // 키 해시 얻기 +// getKeyHash() + // kakao sdk 초기화 KakaoSdk.init(this, "${BuildConfig.KAKAO_NATIVE_APP_KEY}") @@ -44,4 +49,9 @@ class GlobalApplication : Application() { "${BuildConfig.NAVER_OAUTH_CLIENT_NAME}", ) } + + private fun getKeyHash() { + var keyHash = Utility.getKeyHash(this) + Log.i("GlobalApplication", "$keyHash") + } } From 8ecdee63b37ed11882414f63d11417a178e7f3de Mon Sep 17 00:00:00 2001 From: iiolo Date: Tue, 26 Mar 2024 18:38:38 +0900 Subject: [PATCH 05/33] =?UTF-8?q?design:=20=ED=8E=B8=EC=A7=91,=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EB=B2=84=ED=8A=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/fragment_medical_record_add.xml | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/app/src/main/res/layout/fragment_medical_record_add.xml b/app/src/main/res/layout/fragment_medical_record_add.xml index 994219bc..46a586e8 100644 --- a/app/src/main/res/layout/fragment_medical_record_add.xml +++ b/app/src/main/res/layout/fragment_medical_record_add.xml @@ -43,27 +43,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/guideline_medicalrecordadd_top" /> - - - - Date: Tue, 26 Mar 2024 18:39:14 +0900 Subject: [PATCH 06/33] =?UTF-8?q?feat:=20=EB=8B=AC=EB=A0=A5=20bottom=20she?= =?UTF-8?q?et=20=EB=82=A0=EC=A7=9C=20=EC=A0=81=EC=9A=A9=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meongcare/MedicalRecordAddFragment.kt | 31 +++++++- ...icalRecordDateBottomSheetDialogFragment.kt | 75 +++++++++++++++++++ .../bottomsheet_medical_record_add_date.xml | 43 +++++++++++ 3 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/com/project/meongcare/MedicalRecordDateBottomSheetDialogFragment.kt create mode 100644 app/src/main/res/layout/bottomsheet_medical_record_add_date.xml diff --git a/app/src/main/java/com/project/meongcare/MedicalRecordAddFragment.kt b/app/src/main/java/com/project/meongcare/MedicalRecordAddFragment.kt index 531be36b..5c4e8ea1 100644 --- a/app/src/main/java/com/project/meongcare/MedicalRecordAddFragment.kt +++ b/app/src/main/java/com/project/meongcare/MedicalRecordAddFragment.kt @@ -5,9 +5,13 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentManager import com.project.meongcare.databinding.FragmentMedicalRecordAddBinding +import com.project.meongcare.symptom.view.bottomSheet.SymptomBottomSheetDialogFragment +import java.time.LocalDate +import java.time.format.DateTimeFormatter -class MedicalRecordAddFragment : Fragment() { +class MedicalRecordAddFragment : Fragment(), MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener { private lateinit var binding: FragmentMedicalRecordAddBinding override fun onCreateView( @@ -16,6 +20,31 @@ class MedicalRecordAddFragment : Fragment() { savedInstanceState: Bundle?, ): View { binding = FragmentMedicalRecordAddBinding.inflate(inflater) + + binding.run { + textvuewMedicalrecordaddSelectDate.setOnClickListener { + showCalendarBottomSheet(parentFragmentManager, this@MedicalRecordAddFragment) + } + } + + return binding.root } + + + fun showCalendarBottomSheet( + parentFragmentManager: FragmentManager, + onDateSelectedListener: MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener, + ) { + val bottomSheetDialogFragment = MedicalRecordDateBottomSheetDialogFragment() + bottomSheetDialogFragment.setOnDateSelecetedListener(onDateSelectedListener) + bottomSheetDialogFragment.show(parentFragmentManager, "MedicalRecordDateBottomSheetDialogFragment") + } + + override fun onDateSelected(date: LocalDate) { + val formatter = DateTimeFormatter.ofPattern("yyyy년 MM월 dd일") +// val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'00:00:00") + binding.textvuewMedicalrecordaddSelectDate.text = date.format(formatter) + } + } diff --git a/app/src/main/java/com/project/meongcare/MedicalRecordDateBottomSheetDialogFragment.kt b/app/src/main/java/com/project/meongcare/MedicalRecordDateBottomSheetDialogFragment.kt new file mode 100644 index 00000000..761cc711 --- /dev/null +++ b/app/src/main/java/com/project/meongcare/MedicalRecordDateBottomSheetDialogFragment.kt @@ -0,0 +1,75 @@ +package com.project.meongcare + +import android.app.Dialog +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialog +import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.project.meongcare.databinding.BottomsheetMedicalRecordAddDateBinding +import java.time.LocalDate + +class MedicalRecordDateBottomSheetDialogFragment : BottomSheetDialogFragment() { + lateinit var fragmentMedicalRecordBottomSheetBinding: BottomsheetMedicalRecordAddDateBinding + + interface OnDateSelectedListener { + fun onDateSelected(date: LocalDate) + } + + var onDateSelectedListener: OnDateSelectedListener? = null + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle?, + ): View { + fragmentMedicalRecordBottomSheetBinding = BottomsheetMedicalRecordAddDateBinding.inflate(inflater, container, false) + + fragmentMedicalRecordBottomSheetBinding.buttonBottomsheetMedicalRecordAddDateComplete.setOnClickListener { + val datePicker = fragmentMedicalRecordBottomSheetBinding.datepickerBottomsheetMedicalRecordAddDate + val selectedDate = + LocalDate.of(datePicker.year, datePicker.month + 1, datePicker.dayOfMonth) + onDateSelectedListener?.onDateSelected(selectedDate) + dismiss() + } + + return fragmentMedicalRecordBottomSheetBinding.root + } + + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog + val peekHeightInPixels = 0 + + val behavior = dialog.behavior + if (behavior != null) { + behavior.peekHeight = peekHeightInPixels + behavior.state = BottomSheetBehavior.STATE_EXPANDED + } + + return dialog + } + + override fun onViewCreated( + view: View, + savedInstanceState: Bundle?, + ) { + super.onViewCreated(view, savedInstanceState) + removeDatePickerHeader() + } + + fun removeDatePickerHeader() { + fragmentMedicalRecordBottomSheetBinding.run { + val datePickerHeaderId = + fragmentMedicalRecordBottomSheetBinding.datepickerBottomsheetMedicalRecordAddDate.getChildAt(0) + .resources.getIdentifier("date_picker_header", "id", "android") + fragmentMedicalRecordBottomSheetBinding.root.findViewById(datePickerHeaderId).visibility = + View.GONE + } + } + + fun setOnDateSelecetedListener(listener: OnDateSelectedListener) { + this.onDateSelectedListener = listener + } +} diff --git a/app/src/main/res/layout/bottomsheet_medical_record_add_date.xml b/app/src/main/res/layout/bottomsheet_medical_record_add_date.xml new file mode 100644 index 00000000..29033f94 --- /dev/null +++ b/app/src/main/res/layout/bottomsheet_medical_record_add_date.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file From 6c074330232f13b388250ec10be80e648ed2e867 Mon Sep 17 00:00:00 2001 From: iiolo Date: Tue, 26 Mar 2024 20:50:22 +0900 Subject: [PATCH 07/33] =?UTF-8?q?feat:=20=EC=82=AC=EC=A7=84=20=EB=B3=B4?= =?UTF-8?q?=ED=86=B0=EC=8B=9C=ED=8A=B8=20=EA=B4=80=EB=A0=A8=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lRecordPictureBottomSheetDialogFragment.kt | 128 ++++++++++++++++++ .../meongcare/OnPictureChangedListener.kt | 7 + ...bottomsheet_medical_record_add_picture.xml | 82 +++++++++++ 3 files changed, 217 insertions(+) create mode 100644 app/src/main/java/com/project/meongcare/MedicalRecordPictureBottomSheetDialogFragment.kt create mode 100644 app/src/main/java/com/project/meongcare/OnPictureChangedListener.kt create mode 100644 app/src/main/res/layout/bottomsheet_medical_record_add_picture.xml diff --git a/app/src/main/java/com/project/meongcare/MedicalRecordPictureBottomSheetDialogFragment.kt b/app/src/main/java/com/project/meongcare/MedicalRecordPictureBottomSheetDialogFragment.kt new file mode 100644 index 00000000..83c5b95a --- /dev/null +++ b/app/src/main/java/com/project/meongcare/MedicalRecordPictureBottomSheetDialogFragment.kt @@ -0,0 +1,128 @@ +package com.project.meongcare + +import android.app.Activity +import android.app.Dialog +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.os.Environment +import android.provider.MediaStore +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.activity.result.contract.ActivityResultContracts +import androidx.core.content.FileProvider +import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialog +import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.project.meongcare.databinding.BottomsheetMedicalRecordAddPictureBinding +import java.io.File +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +class MedicalRecordPictureBottomSheetDialogFragment : BottomSheetDialogFragment() { + lateinit var fragmentMedicalRecordPictureBottomSheetBinding: BottomsheetMedicalRecordAddPictureBinding + private lateinit var photoURI: Uri + lateinit var file: File + + private var onPictureChangedListener: OnPictureChangedListener? = null + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle?, + ): View { + fragmentMedicalRecordPictureBottomSheetBinding = + BottomsheetMedicalRecordAddPictureBinding.inflate(inflater, container, false) + return fragmentMedicalRecordPictureBottomSheetBinding.root + } + + override fun onViewCreated( + view: View, + savedInstanceState: Bundle?, + ) { + super.onViewCreated(view, savedInstanceState) + fragmentMedicalRecordPictureBottomSheetBinding.run { + textViewMedicalRecordAddPictureCamera.setOnClickListener { + openCamera() + } + textViewMedicalRecordAddPictureGallery.setOnClickListener { + openAlbum() + } + } + } + + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog + val peekHeightInPixels = 0 + + val behavior = dialog.behavior + if (behavior != null) { + behavior.peekHeight = peekHeightInPixels + behavior.state = BottomSheetBehavior.STATE_EXPANDED + } + + return dialog + } + + private val cameraLauncher = + registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> + if (result.resultCode == Activity.RESULT_OK) { + sendUri(photoURI) + dismiss() + } + } + + private val albumLauncher = + registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> + if (result.resultCode == Activity.RESULT_OK) { + result.data?.data?.let { uri -> + sendUri(uri) + dismiss() + } + } + } + + private fun photoFile(): File { + val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date()) + val storageDir: File = + requireContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES)?.let { + File(it, "MedicalRecord") + } ?: throw Exception("Cannot access external storage.") + + storageDir.mkdirs() + return File.createTempFile( + "MedicalRecord_${timeStamp}_", + ".jpg", + storageDir, + ) + } + + private fun openCamera() { + val file = photoFile() + photoURI = + FileProvider.getUriForFile( + requireContext(), + "com.project.meongcare", + file, + ) + val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) + intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI) + cameraLauncher.launch(intent) + } + + private fun openAlbum() { + val intent = Intent(Intent.ACTION_PICK) + intent.type = "image/*" + albumLauncher.launch(intent) + } + + private fun sendUri(uri: Uri) { + onPictureChangedListener?.onPictureChanged(uri) + } + + fun setOnPictureChangedListener(listener: OnPictureChangedListener) { + this.onPictureChangedListener = listener + } +} diff --git a/app/src/main/java/com/project/meongcare/OnPictureChangedListener.kt b/app/src/main/java/com/project/meongcare/OnPictureChangedListener.kt new file mode 100644 index 00000000..f6f0fc29 --- /dev/null +++ b/app/src/main/java/com/project/meongcare/OnPictureChangedListener.kt @@ -0,0 +1,7 @@ +package com.project.meongcare + +import android.net.Uri + +interface OnPictureChangedListener { + fun onPictureChanged(uri: Uri) +} diff --git a/app/src/main/res/layout/bottomsheet_medical_record_add_picture.xml b/app/src/main/res/layout/bottomsheet_medical_record_add_picture.xml new file mode 100644 index 00000000..117989b7 --- /dev/null +++ b/app/src/main/res/layout/bottomsheet_medical_record_add_picture.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From f66c66956b74a550227bc4b45ec201467dffef4c Mon Sep 17 00:00:00 2001 From: iiolo Date: Tue, 2 Apr 2024 20:33:12 +0900 Subject: [PATCH 08/33] =?UTF-8?q?rename:=20=EC=A7=84=EB=A3=8C=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EA=B4=80=EB=A0=A8=20=ED=99=94=EB=A9=B4=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{ => medicalrecord/view}/MedicalRecordAddFragment.kt | 4 ++-- .../{ => medicalrecord/view}/MedicalRecordInfoFragment.kt | 2 +- .../MedicalRecordDateBottomSheetDialogFragment.kt | 2 +- .../MedicalRecordPictureBottomSheetDialogFragment.kt | 3 ++- app/src/main/res/layout/fragment_medical_record_info.xml | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) rename app/src/main/java/com/project/meongcare/{ => medicalrecord/view}/MedicalRecordAddFragment.kt (92%) rename app/src/main/java/com/project/meongcare/{ => medicalrecord/view}/MedicalRecordInfoFragment.kt (92%) rename app/src/main/java/com/project/meongcare/{ => medicalrecord/view/bottomSheet}/MedicalRecordDateBottomSheetDialogFragment.kt (97%) rename app/src/main/java/com/project/meongcare/{ => medicalrecord/view/bottomSheet}/MedicalRecordPictureBottomSheetDialogFragment.kt (97%) diff --git a/app/src/main/java/com/project/meongcare/MedicalRecordAddFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordAddFragment.kt similarity index 92% rename from app/src/main/java/com/project/meongcare/MedicalRecordAddFragment.kt rename to app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordAddFragment.kt index 5c4e8ea1..ee40a465 100644 --- a/app/src/main/java/com/project/meongcare/MedicalRecordAddFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordAddFragment.kt @@ -1,4 +1,4 @@ -package com.project.meongcare +package com.project.meongcare.medicalRecord.view import android.os.Bundle import android.view.LayoutInflater @@ -7,7 +7,7 @@ import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import com.project.meongcare.databinding.FragmentMedicalRecordAddBinding -import com.project.meongcare.symptom.view.bottomSheet.SymptomBottomSheetDialogFragment +import com.project.meongcare.medicalRecord.view.bottomSheet.MedicalRecordDateBottomSheetDialogFragment import java.time.LocalDate import java.time.format.DateTimeFormatter diff --git a/app/src/main/java/com/project/meongcare/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt similarity index 92% rename from app/src/main/java/com/project/meongcare/MedicalRecordInfoFragment.kt rename to app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt index 2ca00573..09dc7a5b 100644 --- a/app/src/main/java/com/project/meongcare/MedicalRecordInfoFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt @@ -1,4 +1,4 @@ -package com.project.meongcare +package com.project.meongcare.medicalRecord.view import android.os.Bundle import android.view.LayoutInflater diff --git a/app/src/main/java/com/project/meongcare/MedicalRecordDateBottomSheetDialogFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordDateBottomSheetDialogFragment.kt similarity index 97% rename from app/src/main/java/com/project/meongcare/MedicalRecordDateBottomSheetDialogFragment.kt rename to app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordDateBottomSheetDialogFragment.kt index 761cc711..27a224bf 100644 --- a/app/src/main/java/com/project/meongcare/MedicalRecordDateBottomSheetDialogFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordDateBottomSheetDialogFragment.kt @@ -1,4 +1,4 @@ -package com.project.meongcare +package com.project.meongcare.medicalRecord.view.bottomSheet import android.app.Dialog import android.os.Bundle diff --git a/app/src/main/java/com/project/meongcare/MedicalRecordPictureBottomSheetDialogFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordPictureBottomSheetDialogFragment.kt similarity index 97% rename from app/src/main/java/com/project/meongcare/MedicalRecordPictureBottomSheetDialogFragment.kt rename to app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordPictureBottomSheetDialogFragment.kt index 83c5b95a..16b35323 100644 --- a/app/src/main/java/com/project/meongcare/MedicalRecordPictureBottomSheetDialogFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordPictureBottomSheetDialogFragment.kt @@ -1,4 +1,4 @@ -package com.project.meongcare +package com.project.meongcare.medicalRecord.view.bottomSheet import android.app.Activity import android.app.Dialog @@ -15,6 +15,7 @@ import androidx.core.content.FileProvider import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.project.meongcare.OnPictureChangedListener import com.project.meongcare.databinding.BottomsheetMedicalRecordAddPictureBinding import java.io.File import java.text.SimpleDateFormat diff --git a/app/src/main/res/layout/fragment_medical_record_info.xml b/app/src/main/res/layout/fragment_medical_record_info.xml index 663366f4..6c7c435c 100644 --- a/app/src/main/res/layout/fragment_medical_record_info.xml +++ b/app/src/main/res/layout/fragment_medical_record_info.xml @@ -11,7 +11,7 @@ + tools:context=".medicalRecord.view.MedicalRecordInfoFragment"> Date: Fri, 5 Apr 2024 21:37:54 +0900 Subject: [PATCH 09/33] =?UTF-8?q?feat:=20medicalRecord=20=ED=95=9C?= =?UTF-8?q?=EA=B0=9C=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?get=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/data/remote/MedicalRecordApi.kt | 12 +++++-- .../repository/MedicalRecordRepository.kt | 10 ++++-- .../repository/MedicalRecordRepositoryImpl.kt | 28 ++++++++++++++--- .../model/entities/MedicalRecordGet.kt | 10 ++++++ .../view/MedicalRecordInfoFragment.kt | 31 +++++++++++++++++++ .../viewmodel/MedicalRecordViewModel.kt | 20 ++++++++++-- 6 files changed, 100 insertions(+), 11 deletions(-) create mode 100644 app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGet.kt diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt index b0819078..b182728e 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt @@ -1,10 +1,12 @@ -package com.project.meongcare.medicalrecord.model.data.remote +package com.project.meongcare.medicalRecord.model.data.remote -import com.project.meongcare.medicalrecord.model.entities.MedicalRecordGetResponse +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGetResponse import retrofit2.Response import retrofit2.http.DELETE import retrofit2.http.GET import retrofit2.http.Header +import retrofit2.http.Path import retrofit2.http.Query interface MedicalRecordApi { @@ -15,6 +17,12 @@ interface MedicalRecordApi { @Header("AccessToken") accessToken: String, ): Response + @GET("medical-record/{medicalRecordId}") + suspend fun getMedicalRecord( + @Path("medicalRecordId") medicalRecordId: Long, + @Header("AccessToken") accessToken: String, + ): Response + @DELETE("medical-record") suspend fun deleteMedicalRecordList( @Query("medicalRecordIds") medicalRecordIds: IntArray, diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt index fe52f2dc..73a54359 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt @@ -1,6 +1,7 @@ -package com.project.meongcare.medicalrecord.model.data.repository +package com.project.meongcare.medicalRecord.model.data.repository -import com.project.meongcare.medicalrecord.model.entities.MedicalRecordGetResponse +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGetResponse import retrofit2.Response interface MedicalRecordRepository { @@ -10,6 +11,11 @@ interface MedicalRecordRepository { accessToken: String, ): Response? + suspend fun getMedicalRecord( + medicalRecordId: Long, + accessToken: String, + ): Response? + suspend fun deleteMedicalRecordList( medicalRecordIds: IntArray, accessToken: String, diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt index b1f4994a..cdd5447c 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt @@ -1,8 +1,9 @@ -package com.project.meongcare.medicalrecord.model.data.repository +package com.project.meongcare.medicalRecord.model.data.repository import android.util.Log -import com.project.meongcare.medicalrecord.model.data.remote.MedicalRecordRetrofitClient -import com.project.meongcare.medicalrecord.model.entities.MedicalRecordGetResponse +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet +import com.project.meongcare.medicalRecord.model.data.remote.MedicalRecordRetrofitClient +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGetResponse import org.json.JSONObject import retrofit2.Response import javax.inject.Inject @@ -30,7 +31,26 @@ class MedicalRecordRepositoryImpl } } - override suspend fun deleteMedicalRecordList( + override suspend fun getMedicalRecord( + medicalRecordId: Long, + accessToken: String + ): Response? { + return try { + val response = medicalRecordRetrofitClient.medicalRecordApi.getMedicalRecord(medicalRecordId, accessToken) + if (response.isSuccessful) { + Log.d("MedicalRepo-Get", "통신 성공 : ${response.code()}") + response + } else { + Log.d("MedicalRepo-Get", "통신 실패 : ${response.code()}") + response + } + } catch (e: Exception) { + e.printStackTrace() + null + } + } + + override suspend fun deleteMedicalRecordList( medicalRecordIds: IntArray, accessToken: String, ): Int? { diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGet.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGet.kt new file mode 100644 index 00000000..b00d8837 --- /dev/null +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGet.kt @@ -0,0 +1,10 @@ +package com.project.meongcare.medicalRecord.model.entities + +data class MedicalRecordGet( + val medicalRecordId: Long, + val dateTime: String, + val hospitalName: String, + val doctorName: String, + val note: String, + val imageUrl: String, +) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt index 09dc7a5b..d6ae64f6 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt @@ -1,14 +1,26 @@ package com.project.meongcare.medicalRecord.view import android.os.Bundle +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment +import androidx.fragment.app.viewModels import com.project.meongcare.databinding.FragmentMedicalRecordInfoBinding +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet +import com.project.meongcare.medicalRecord.viewmodel.MedicalRecordViewModel +import com.project.meongcare.medicalRecord.viewmodel.UserViewModel +import dagger.hilt.android.AndroidEntryPoint +import retrofit2.Response +@AndroidEntryPoint class MedicalRecordInfoFragment : Fragment() { private lateinit var binding: FragmentMedicalRecordInfoBinding + private val medicalRecordViewModel: MedicalRecordViewModel by viewModels() + + private var accessToken = "" + private var medicalRecordId = 0L override fun onCreateView( inflater: LayoutInflater, @@ -18,4 +30,23 @@ class MedicalRecordInfoFragment : Fragment() { binding = FragmentMedicalRecordInfoBinding.inflate(inflater) return binding.root } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + medicalRecordId = 1 + accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjMyMjgxNX0.keYXq_bTXsX0o_V2MmnH0X6Ghs9FWUxg46Yb9Ba7tGY" + + medicalRecordViewModel.getMedicalRecord(medicalRecordId,accessToken) + + medicalRecordViewModel.medicalRecord.observe(viewLifecycleOwner) { + testGetRecord(it) + + } + + } + + private fun testGetRecord(it: Response) { + Log.d("진료기록 테스트", it.toString()) + Log.d("진료기록 테스트2", it.body().toString()) + } } 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 338eaf2f..dbce8f44 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 @@ -1,11 +1,12 @@ -package com.project.meongcare.medicalrecord.viewmodel +package com.project.meongcare.medicalRecord.viewmodel import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.project.meongcare.medicalrecord.model.data.repository.MedicalRecordRepositoryImpl -import com.project.meongcare.medicalrecord.model.entities.MedicalRecordGetResponse +import com.project.meongcare.medicalRecord.model.data.repository.MedicalRecordRepositoryImpl +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGetResponse import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch import retrofit2.Response @@ -21,6 +22,10 @@ class MedicalRecordViewModel val medicalRecordList: LiveData> get() = _medicalRecordList + private val _medicalRecord = MutableLiveData>() + val medicalRecord: LiveData> + get() = _medicalRecord + private val _selectedDate = MutableLiveData() val selectedDate: LiveData get() = _selectedDate @@ -43,6 +48,15 @@ class MedicalRecordViewModel } } + fun getMedicalRecord( + medicalRecordId: Long, + accessToken: String, + ) { + viewModelScope.launch { + _medicalRecord.value = medicalRecordRepositoryImpl.getMedicalRecord(medicalRecordId, accessToken) + } + } + fun getCurrentDate(date: String?) { _selectedDate.value = date } From 3271d0e44512fac3fbd0cc7446bb5e171d8b5fc5 Mon Sep 17 00:00:00 2001 From: iiolo Date: Fri, 5 Apr 2024 23:08:48 +0900 Subject: [PATCH 10/33] =?UTF-8?q?design:=20=EC=A7=84=EB=A3=8C=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EA=B0=84=EA=B2=A9=20=EC=88=98=EC=A0=95=20=EB=B0=8F?= =?UTF-8?q?=20=EB=AC=B8=EC=9E=90=EC=97=B4=20=EA=B0=92=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/fragment_medical_record_info.xml | 141 +++++++++--------- .../main/res/values/strings-medicalrecord.xml | 6 +- 2 files changed, 75 insertions(+), 72 deletions(-) diff --git a/app/src/main/res/layout/fragment_medical_record_info.xml b/app/src/main/res/layout/fragment_medical_record_info.xml index 6c7c435c..a67620a0 100644 --- a/app/src/main/res/layout/fragment_medical_record_info.xml +++ b/app/src/main/res/layout/fragment_medical_record_info.xml @@ -69,7 +69,7 @@ android:layout_width="0dp" android:layout_height="0dp" android:layout_marginTop="25dp" - app:layout_constraintBottom_toTopOf="@id/layout_medicalrecordinfo_note_record" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@id/guideline_medicalrecordinfo_end" app:layout_constraintStart_toStartOf="@id/guideline_medicalrecordinfo_start" app:layout_constraintTop_toBottomOf="@id/imagebutton_medicalrecordinfo_back"> @@ -109,15 +109,6 @@ android:layout_gravity="center_horizontal" android:src="@drawable/medical_record_add_carrier" /> - @@ -140,23 +131,13 @@ android:background="@drawable/all_rect_r5" android:paddingVertical="11dp" android:paddingStart="16dp" - android:text="@string/all_select_date" - android:textAppearance="@style/Typography.Body1.Regular" - android:textColor="@color/gray4" + android:text="0000년 00월 00일" + android:textColor="@color/black" + android:textAppearance="@style/Typography.Body1.Medium" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/textview_medicalrecordinfo_date" /> - - - + app:layout_constraintTop_toBottomOf="@+id/textview_medicalrecordinfo_treatment_time" /> + + + app:layout_constraintTop_toBottomOf="@+id/textview_medicalrecordinfo_hospital" /> - + app:layout_constraintTop_toTopOf="@id/view_medicalrecordinfo_hospital_name" + tools:text="0/50" /> + + + + app:layout_constraintTop_toBottomOf="@id/textview_medicalrecordinfo_veterinarian" /> - + app:layout_constraintTop_toTopOf="@id/view_medicalrecordinfo_veterinarian_name" /> + app:layout_constraintTop_toTopOf="@id/view_medicalrecordinfo_veterinarian_name" + tools:text="0/10" /> + + app:layout_constraintTop_toBottomOf="@id/textview_medicalrecordinfo_note" /> - + app:layout_constraintTop_toTopOf="@id/view_medicalrecordinfo_note" + tools:text="0/500" /> - - diff --git a/app/src/main/res/values/strings-medicalrecord.xml b/app/src/main/res/values/strings-medicalrecord.xml index a7077a29..ba6812b1 100644 --- a/app/src/main/res/values/strings-medicalrecord.xml +++ b/app/src/main/res/values/strings-medicalrecord.xml @@ -6,11 +6,13 @@ 사진을 첨부해주세요 진료 날짜 진료 시각 + 동물병원 병원 이름 + 담당의 담당의 성함 - 노트 + 내용 %d/50 - %d/10 + %d/10 %d/500 생성된 진료기록이 없습니다. 전체 선택 From 1238e53016113798cb54b69feb10dca2a3e794a1 Mon Sep 17 00:00:00 2001 From: iiolo Date: Fri, 5 Apr 2024 23:10:48 +0900 Subject: [PATCH 11/33] =?UTF-8?q?feat:=20=EC=A7=84=EB=A3=8C=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=EC=9D=98=20=EB=82=A0=EC=A7=9C,=20=EC=8B=9C=EA=B0=81,?= =?UTF-8?q?=20=EB=8F=99=EB=AC=BC=EB=B3=80=EC=9B=90,=20=EB=8B=B4=EB=8B=B9?= =?UTF-8?q?=EC=9D=98,=20=EB=82=B4=EC=9A=A9=20=EC=A0=95=EB=B3=B4=20set?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/utils/MedicalRecordUtils.kt | 25 ++++++++++ .../view/MedicalRecordInfoFragment.kt | 50 +++++++++++++++++-- 2 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt new file mode 100644 index 00000000..d6be9907 --- /dev/null +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt @@ -0,0 +1,25 @@ +package com.project.meongcare.medicalRecord.model.utils + +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter +import java.util.Locale + +class MedicalRecordUtils { + companion object { + fun convertMDateToSimpleDate(localMili: String): String { + val inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss") + val dateTime = LocalDateTime.parse(localMili, inputFormatter) + + val outputFormatter = DateTimeFormatter.ofPattern("yyyy년 M월 d일", Locale.getDefault()) + return dateTime.format(outputFormatter) + } + + fun convertMDateToSimpleTime(localMili: String): String { + val inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss") + val dateTime = LocalDateTime.parse(localMili, inputFormatter) + + val outputFormatter = DateTimeFormatter.ofPattern("a hh:mm", Locale.getDefault()) + return dateTime.format(outputFormatter) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt index d6ae64f6..b6ae9c86 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt @@ -7,10 +7,12 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels +import com.project.meongcare.R import com.project.meongcare.databinding.FragmentMedicalRecordInfoBinding import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet +import com.project.meongcare.medicalRecord.model.utils.MedicalRecordUtils.Companion.convertMDateToSimpleDate +import com.project.meongcare.medicalRecord.model.utils.MedicalRecordUtils.Companion.convertMDateToSimpleTime import com.project.meongcare.medicalRecord.viewmodel.MedicalRecordViewModel -import com.project.meongcare.medicalRecord.viewmodel.UserViewModel import dagger.hilt.android.AndroidEntryPoint import retrofit2.Response @@ -34,15 +36,53 @@ class MedicalRecordInfoFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) medicalRecordId = 1 - accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjMyMjgxNX0.keYXq_bTXsX0o_V2MmnH0X6Ghs9FWUxg46Yb9Ba7tGY" + accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjMyODIyNX0.0iSzVTXVbhAc2EhhLDUTDpUqS46e4qy7a3A4rdTOUe0" - medicalRecordViewModel.getMedicalRecord(medicalRecordId,accessToken) medicalRecordViewModel.medicalRecord.observe(viewLifecycleOwner) { - testGetRecord(it) - + if (it.code() == 200) { + testGetRecord(it) + val record = it.body() as MedicalRecordGet + setDate(record) + setTime(record) + setHospital(record) + setVeterinarian(record) + setNote(record) + } } + initMedicalRecord() + + } + + private fun setNote(record: MedicalRecordGet) { + binding.textViewMedicalrecordinfoNoteDetail.text = record.note + binding.textviewMedicalrecordinfoNoteCount.text = + getString(R.string.medicalrecord_note_length, record.note.length) + } + + private fun initMedicalRecord() { + medicalRecordViewModel.getMedicalRecord(medicalRecordId, accessToken) + } + + private fun setVeterinarian(record: MedicalRecordGet) { + binding.textViewMedicalrecordinfoVeterinarianName.text = record.doctorName + binding.textviewMedicalrecordinfoVeterinarianNameCount.text = + getString(R.string.medicalrecord_veterinarian_name_length, record.doctorName.length) + } + + private fun setHospital(record: MedicalRecordGet) { + binding.textviewMedicalrecordinfoHospitalName.text = record.hospitalName + binding.textviewMedicalrecordinfoHospitalNameCount.text = + getString(R.string.medicalrecord_hospital_name_length, record.hospitalName.length) + } + + private fun setTime(record: MedicalRecordGet) { + binding.textvuewMedicalrecordinfoTime.text = convertMDateToSimpleTime(record.dateTime) + } + + private fun setDate(record: MedicalRecordGet) { + binding.textvuewMedicalrecordinfoSelectDate.text = convertMDateToSimpleDate(record.dateTime) } private fun testGetRecord(it: Response) { From 7c24c5cf3031b5701be318ad76a4ae765879aef3 Mon Sep 17 00:00:00 2001 From: iiolo Date: Fri, 5 Apr 2024 23:46:50 +0900 Subject: [PATCH 12/33] =?UTF-8?q?rename:=20=ED=8F=B4=EB=8D=94=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/data/local/MedicalRecordItemCheckListener.kt | 2 +- .../model/data/local/MedicalRecordItemClickListener.kt | 2 +- .../model/data/repository/MedicalRecordModule.kt | 2 +- .../medicalrecord/model/entities/MedicalRecord.kt | 2 +- .../model/entities/MedicalRecordGetResponse.kt | 2 +- .../model/utils/MedicalRecordDateUtils.kt | 2 +- .../medicalrecord/view/MedicalRecordEditFragment.kt | 10 +++++----- .../medicalrecord/view/MedicalRecordEditListAdapter.kt | 8 ++++---- .../medicalrecord/view/MedicalRecordFragment.kt | 10 +++++----- .../medicalrecord/view/MedicalRecordListAdapter.kt | 8 ++++---- .../meongcare/medicalrecord/viewmodel/DogViewModel.kt | 2 +- .../meongcare/medicalrecord/viewmodel/UserViewModel.kt | 2 +- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemCheckListener.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemCheckListener.kt index b3cd58b8..c0841f4b 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemCheckListener.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemCheckListener.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.model.data.local +package com.project.meongcare.medicalRecord.model.data.local interface MedicalRecordItemCheckListener { fun onMedicalRecordItemChecked(medicalRecordIds: IntArray) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemClickListener.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemClickListener.kt index 5c29b22e..a994ff0f 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemClickListener.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemClickListener.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.model.data.local +package com.project.meongcare.medicalRecord.model.data.local interface MedicalRecordItemClickListener { fun onMedicalRecordItemClick(medicalRecordId: Long) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordModule.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordModule.kt index f413de56..ab692a9d 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordModule.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordModule.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.model.data.repository +package com.project.meongcare.medicalRecord.model.data.repository import dagger.Module import dagger.Provides diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecord.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecord.kt index 2f757a46..c48ab429 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecord.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecord.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.model.entities +package com.project.meongcare.medicalRecord.model.entities data class MedicalRecord( val medicalRecordId: Long, diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGetResponse.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGetResponse.kt index 7edb4661..a4c3bb5c 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGetResponse.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGetResponse.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.model.entities +package com.project.meongcare.medicalRecord.model.entities data class MedicalRecordGetResponse( val records: MutableList, diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordDateUtils.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordDateUtils.kt index 8251fbad..410b8d8d 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordDateUtils.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordDateUtils.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.model.utils +package com.project.meongcare.medicalRecord.model.utils object MedicalRecordDateUtils { fun showFormattedTime(dateTime: String): String { diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordEditFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordEditFragment.kt index d337595d..0b89402c 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordEditFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordEditFragment.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.view +package com.project.meongcare.medicalRecord.view import android.os.Bundle import android.util.Log @@ -12,10 +12,10 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.google.android.material.checkbox.MaterialCheckBox import com.project.meongcare.R import com.project.meongcare.databinding.FragmentMedicalRecordEditBinding -import com.project.meongcare.medicalrecord.model.data.local.MedicalRecordItemCheckListener -import com.project.meongcare.medicalrecord.viewmodel.DogViewModel -import com.project.meongcare.medicalrecord.viewmodel.MedicalRecordViewModel -import com.project.meongcare.medicalrecord.viewmodel.UserViewModel +import com.project.meongcare.medicalRecord.model.data.local.MedicalRecordItemCheckListener +import com.project.meongcare.medicalRecord.viewmodel.DogViewModel +import com.project.meongcare.medicalRecord.viewmodel.MedicalRecordViewModel +import com.project.meongcare.medicalRecord.viewmodel.UserViewModel import com.project.meongcare.snackbar.view.CustomSnackBar import dagger.hilt.android.AndroidEntryPoint diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordEditListAdapter.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordEditListAdapter.kt index 23ccc244..9fea4afa 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordEditListAdapter.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordEditListAdapter.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.view +package com.project.meongcare.medicalRecord.view import android.view.LayoutInflater import android.view.ViewGroup @@ -6,9 +6,9 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.project.meongcare.databinding.ItemMedicalRecordEditBinding -import com.project.meongcare.medicalrecord.model.data.local.MedicalRecordItemCheckListener -import com.project.meongcare.medicalrecord.model.entities.MedicalRecord -import com.project.meongcare.medicalrecord.model.utils.MedicalRecordDateUtils.showFormattedTime +import com.project.meongcare.medicalRecord.model.data.local.MedicalRecordItemCheckListener +import com.project.meongcare.medicalRecord.model.entities.MedicalRecord +import com.project.meongcare.medicalRecord.model.utils.MedicalRecordDateUtils.showFormattedTime class MedicalRecordEditListAdapter( private val medicalRecordItemCheckListener: MedicalRecordItemCheckListener, diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordFragment.kt index 53549f4e..2f5457b9 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordFragment.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.view +package com.project.meongcare.medicalRecord.view import android.graphics.Typeface import android.os.Bundle @@ -13,10 +13,10 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.archit.calendardaterangepicker.customviews.CalendarListener import com.project.meongcare.R import com.project.meongcare.databinding.FragmentMedicalRecordBinding -import com.project.meongcare.medicalrecord.model.data.local.MedicalRecordItemClickListener -import com.project.meongcare.medicalrecord.viewmodel.DogViewModel -import com.project.meongcare.medicalrecord.viewmodel.MedicalRecordViewModel -import com.project.meongcare.medicalrecord.viewmodel.UserViewModel +import com.project.meongcare.medicalRecord.model.data.local.MedicalRecordItemClickListener +import com.project.meongcare.medicalRecord.viewmodel.DogViewModel +import com.project.meongcare.medicalRecord.viewmodel.MedicalRecordViewModel +import com.project.meongcare.medicalRecord.viewmodel.UserViewModel import com.project.meongcare.snackbar.view.CustomSnackBar import dagger.hilt.android.AndroidEntryPoint import java.text.SimpleDateFormat diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordListAdapter.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordListAdapter.kt index 19ed3db9..d3af5e13 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordListAdapter.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordListAdapter.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.view +package com.project.meongcare.medicalRecord.view import android.view.LayoutInflater import android.view.ViewGroup @@ -6,9 +6,9 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.project.meongcare.databinding.ItemMedicalRecordBinding -import com.project.meongcare.medicalrecord.model.data.local.MedicalRecordItemClickListener -import com.project.meongcare.medicalrecord.model.entities.MedicalRecord -import com.project.meongcare.medicalrecord.model.utils.MedicalRecordDateUtils.showFormattedTime +import com.project.meongcare.medicalRecord.model.data.local.MedicalRecordItemClickListener +import com.project.meongcare.medicalRecord.model.entities.MedicalRecord +import com.project.meongcare.medicalRecord.model.utils.MedicalRecordDateUtils.showFormattedTime class MedicalRecordListAdapter( private val medicalRecordItemClickListener: MedicalRecordItemClickListener, diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/viewmodel/DogViewModel.kt b/app/src/main/java/com/project/meongcare/medicalrecord/viewmodel/DogViewModel.kt index c7d44da5..5238bac0 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/viewmodel/DogViewModel.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/viewmodel/DogViewModel.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.viewmodel +package com.project.meongcare.medicalRecord.viewmodel import androidx.lifecycle.ViewModel import androidx.lifecycle.asLiveData diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/viewmodel/UserViewModel.kt b/app/src/main/java/com/project/meongcare/medicalrecord/viewmodel/UserViewModel.kt index fd06c16d..f0c2be61 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/viewmodel/UserViewModel.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/viewmodel/UserViewModel.kt @@ -1,4 +1,4 @@ -package com.project.meongcare.medicalrecord.viewmodel +package com.project.meongcare.medicalRecord.viewmodel import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData From 45a4bde393b0f076c2f5e27129fe1c888459f113 Mon Sep 17 00:00:00 2001 From: iiolo Date: Fri, 5 Apr 2024 23:52:40 +0900 Subject: [PATCH 13/33] =?UTF-8?q?feat:=20=EC=A7=84=EB=A3=8C=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=A0=95=EB=B3=B4=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?set=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/MedicalRecordInfoFragment.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt index b6ae9c86..eb621362 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt @@ -7,6 +7,7 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels +import com.bumptech.glide.Glide import com.project.meongcare.R import com.project.meongcare.databinding.FragmentMedicalRecordInfoBinding import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet @@ -36,13 +37,12 @@ class MedicalRecordInfoFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) medicalRecordId = 1 - accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjMyODIyNX0.0iSzVTXVbhAc2EhhLDUTDpUqS46e4qy7a3A4rdTOUe0" - + accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjMzMjE4Mn0.EVtsKue6RNJ9B_5imPJRHwg1VzhyCTfT0b5B7LObDKA" medicalRecordViewModel.medicalRecord.observe(viewLifecycleOwner) { if (it.code() == 200) { - testGetRecord(it) val record = it.body() as MedicalRecordGet + setImg(record) setDate(record) setTime(record) setHospital(record) @@ -55,6 +55,15 @@ class MedicalRecordInfoFragment : Fragment() { } + private fun setImg(record: MedicalRecordGet) { + if (!record.imageUrl.isNullOrBlank()) { + binding.imageviewMedicalrecordinfoCarrier.visibility = View.GONE + Glide.with(this@MedicalRecordInfoFragment) + .load(record.imageUrl) + .into(binding.imageviewMedicalrecordinfoImage) + } + } + private fun setNote(record: MedicalRecordGet) { binding.textViewMedicalrecordinfoNoteDetail.text = record.note binding.textviewMedicalrecordinfoNoteCount.text = From a3db6d5e18c8236ed58f2f412ee0cdd322077699 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 00:01:57 +0900 Subject: [PATCH 14/33] =?UTF-8?q?feat:=20=EC=A7=84=EB=A3=8C=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=ED=99=94=EB=A9=B4=20=EB=B0=B1=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/MedicalRecordInfoFragment.kt | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt index eb621362..8125e476 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt @@ -7,6 +7,7 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels +import androidx.navigation.fragment.findNavController import com.bumptech.glide.Glide import com.project.meongcare.R import com.project.meongcare.databinding.FragmentMedicalRecordInfoBinding @@ -39,6 +40,18 @@ class MedicalRecordInfoFragment : Fragment() { medicalRecordId = 1 accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjMzMjE4Mn0.EVtsKue6RNJ9B_5imPJRHwg1VzhyCTfT0b5B7LObDKA" + setMedicalRecord() + getMedicalRecord() + initBackBtn() + } + + private fun initBackBtn() { + binding.imagebuttonMedicalrecordinfoBack.setOnClickListener { + findNavController().popBackStack() + } + } + + private fun setMedicalRecord() { medicalRecordViewModel.medicalRecord.observe(viewLifecycleOwner) { if (it.code() == 200) { val record = it.body() as MedicalRecordGet @@ -50,9 +63,6 @@ class MedicalRecordInfoFragment : Fragment() { setNote(record) } } - - initMedicalRecord() - } private fun setImg(record: MedicalRecordGet) { @@ -70,10 +80,6 @@ class MedicalRecordInfoFragment : Fragment() { getString(R.string.medicalrecord_note_length, record.note.length) } - private fun initMedicalRecord() { - medicalRecordViewModel.getMedicalRecord(medicalRecordId, accessToken) - } - private fun setVeterinarian(record: MedicalRecordGet) { binding.textViewMedicalrecordinfoVeterinarianName.text = record.doctorName binding.textviewMedicalrecordinfoVeterinarianNameCount.text = @@ -94,6 +100,10 @@ class MedicalRecordInfoFragment : Fragment() { binding.textvuewMedicalrecordinfoSelectDate.text = convertMDateToSimpleDate(record.dateTime) } + private fun getMedicalRecord() { + medicalRecordViewModel.getMedicalRecord(medicalRecordId, accessToken) + } + private fun testGetRecord(it: Response) { Log.d("진료기록 테스트", it.toString()) Log.d("진료기록 테스트2", it.body().toString()) From d6895e02c917c9a8a3a7e820791e0ffb1424d7d5 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 00:12:14 +0900 Subject: [PATCH 15/33] =?UTF-8?q?feat:=20=EC=A7=84=EB=A3=8C=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=ED=99=94=EB=A9=B4=20=EC=82=AD=EC=A0=9C=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/MedicalRecordInfoFragment.kt | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt index 8125e476..a40c8592 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt @@ -15,6 +15,7 @@ import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet import com.project.meongcare.medicalRecord.model.utils.MedicalRecordUtils.Companion.convertMDateToSimpleDate import com.project.meongcare.medicalRecord.model.utils.MedicalRecordUtils.Companion.convertMDateToSimpleTime import com.project.meongcare.medicalRecord.viewmodel.MedicalRecordViewModel +import com.project.meongcare.snackbar.view.CustomSnackBar import dagger.hilt.android.AndroidEntryPoint import retrofit2.Response @@ -38,11 +39,36 @@ class MedicalRecordInfoFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) medicalRecordId = 1 - accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjMzMjE4Mn0.EVtsKue6RNJ9B_5imPJRHwg1VzhyCTfT0b5B7LObDKA" + accessToken = + "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjMzMjE4Mn0.EVtsKue6RNJ9B_5imPJRHwg1VzhyCTfT0b5B7LObDKA" setMedicalRecord() getMedicalRecord() initBackBtn() + initDeleteBtn() + } + + private fun initDeleteBtn() { + binding.imagebuttonMedicalrecordinfoDelete.setOnClickListener { + medicalRecordViewModel.deleteMedicalRecordList( + intArrayOf(medicalRecordId.toInt()), + accessToken + ) + } + isDeleteSuccess() + } + + private fun isDeleteSuccess() { + medicalRecordViewModel.deleteMedicalRecordResponse.observe(viewLifecycleOwner) { response -> + if (response != null && response == 200) { + CustomSnackBar.make( + requireView(), + R.drawable.snackbar_success_16dp, + getString(R.string.medicalrecord_delete_success), + ).show() + findNavController().popBackStack() + } + } } private fun initBackBtn() { From 12501924f35df3bedfae9a4c3550ef94adf92ec8 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 00:44:39 +0900 Subject: [PATCH 16/33] =?UTF-8?q?design:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EB=B0=B0=EC=B9=98=20=EC=88=98=EC=A0=95,?= =?UTF-8?q?=20=ED=95=84=EC=88=98=20=ED=91=9C=EC=8B=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/fragment_medical_record_add.xml | 193 ++++++++++++------ .../main/res/values/strings-medicalrecord.xml | 2 +- 2 files changed, 137 insertions(+), 58 deletions(-) diff --git a/app/src/main/res/layout/fragment_medical_record_add.xml b/app/src/main/res/layout/fragment_medical_record_add.xml index 46a586e8..d442d3f0 100644 --- a/app/src/main/res/layout/fragment_medical_record_add.xml +++ b/app/src/main/res/layout/fragment_medical_record_add.xml @@ -68,28 +68,35 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - - - + android:layout_gravity="center" + android:orientation="vertical"> + + + + + - + @@ -103,8 +110,26 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/cardview_medicalrecordadd_image" /> + + + + + android:src="@drawable/all_calendar_gray4" + app:layout_constraintBottom_toBottomOf="@id/textview_medicalrecordadd_select_date" + app:layout_constraintEnd_toEndOf="@id/textview_medicalrecordadd_select_date" + app:layout_constraintTop_toTopOf="@id/textview_medicalrecordadd_select_date" /> + app:layout_constraintTop_toBottomOf="@id/textview_medicalrecordadd_select_date" /> + + + + + app:layout_constraintTop_toBottomOf="@+id/textview_medicalrecordadd_hospital" /> + app:layout_constraintTop_toTopOf="@id/view_medicalrecordadd_hospital_name" + tools:text="0/50" /> + + + + + + app:layout_constraintTop_toBottomOf="@id/textview_medicalrecordadd_veterinarian" /> + app:layout_constraintTop_toTopOf="@id/view_medicalrecordadd_veterinarian_name" /> + app:layout_constraintTop_toTopOf="@id/view_medicalrecordadd_veterinarian_name" + tools:text="0/10" /> + + + + app:layout_constraintTop_toBottomOf="@id/textview_medicalrecordadd_note" /> + app:layout_constraintTop_toTopOf="@id/view_medicalrecordadd_note" + tools:text="0/500" /> diff --git a/app/src/main/res/values/strings-medicalrecord.xml b/app/src/main/res/values/strings-medicalrecord.xml index ba6812b1..c78da584 100644 --- a/app/src/main/res/values/strings-medicalrecord.xml +++ b/app/src/main/res/values/strings-medicalrecord.xml @@ -6,7 +6,7 @@ 사진을 첨부해주세요 진료 날짜 진료 시각 - 동물병원 + 동물 병원 병원 이름 담당의 담당의 성함 From c6a99ada06d7078a2396a17b18d4ae6abe32498c Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 00:46:08 +0900 Subject: [PATCH 17/33] =?UTF-8?q?refactor:=20=EC=95=84=EC=9D=B4=EB=94=94?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meongcare/medicalrecord/view/MedicalRecordAddFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 ee40a465..59eba193 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 @@ -22,7 +22,7 @@ class MedicalRecordAddFragment : Fragment(), MedicalRecordDateBottomSheetDialogF binding = FragmentMedicalRecordAddBinding.inflate(inflater) binding.run { - textvuewMedicalrecordaddSelectDate.setOnClickListener { + textviewMedicalrecordaddSelectDate.setOnClickListener { showCalendarBottomSheet(parentFragmentManager, this@MedicalRecordAddFragment) } } @@ -44,7 +44,7 @@ class MedicalRecordAddFragment : Fragment(), MedicalRecordDateBottomSheetDialogF override fun onDateSelected(date: LocalDate) { val formatter = DateTimeFormatter.ofPattern("yyyy년 MM월 dd일") // val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'00:00:00") - binding.textvuewMedicalrecordaddSelectDate.text = date.format(formatter) + binding.textviewMedicalrecordaddSelectDate.text = date.format(formatter) } } From 84508aebfeb02f9a539bceb5d3be437989b194ab Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 01:20:52 +0900 Subject: [PATCH 18/33] =?UTF-8?q?feat:=20=EC=A0=84=EC=97=AD=EB=B3=80?= =?UTF-8?q?=EC=88=98=EB=A1=9C=20=EB=82=A0=EC=A7=9C=20=EA=B0=92=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/MedicalRecordAddFragment.kt | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 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 59eba193..b74f902e 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 @@ -1,6 +1,7 @@ package com.project.meongcare.medicalRecord.view import android.os.Bundle +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -11,8 +12,10 @@ import com.project.meongcare.medicalRecord.view.bottomSheet.MedicalRecordDateBot import java.time.LocalDate import java.time.format.DateTimeFormatter -class MedicalRecordAddFragment : Fragment(), MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener { +class MedicalRecordAddFragment : Fragment(), + MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener { private lateinit var binding: FragmentMedicalRecordAddBinding + private var addSelectedDate: String = "" override fun onCreateView( inflater: LayoutInflater, @@ -20,17 +23,19 @@ class MedicalRecordAddFragment : Fragment(), MedicalRecordDateBottomSheetDialogF savedInstanceState: Bundle?, ): View { binding = FragmentMedicalRecordAddBinding.inflate(inflater) - - binding.run { - textviewMedicalrecordaddSelectDate.setOnClickListener { - showCalendarBottomSheet(parentFragmentManager, this@MedicalRecordAddFragment) - } - } - - return binding.root } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + initDateBtn() + } + + private fun initDateBtn() { + binding.textviewMedicalrecordaddSelectDate.setOnClickListener { + showCalendarBottomSheet(parentFragmentManager, this@MedicalRecordAddFragment) + } + } fun showCalendarBottomSheet( parentFragmentManager: FragmentManager, @@ -38,13 +43,18 @@ class MedicalRecordAddFragment : Fragment(), MedicalRecordDateBottomSheetDialogF ) { val bottomSheetDialogFragment = MedicalRecordDateBottomSheetDialogFragment() bottomSheetDialogFragment.setOnDateSelecetedListener(onDateSelectedListener) - bottomSheetDialogFragment.show(parentFragmentManager, "MedicalRecordDateBottomSheetDialogFragment") + bottomSheetDialogFragment.show( + parentFragmentManager, + "MedicalRecordDateBottomSheetDialogFragment" + ) } override fun onDateSelected(date: LocalDate) { - val formatter = DateTimeFormatter.ofPattern("yyyy년 MM월 dd일") + val formatter = DateTimeFormatter.ofPattern("yyyy년 M월 d일") + val formatterToAdd = DateTimeFormatter.ofPattern("yyyy-MM-dd") // val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'00:00:00") + addSelectedDate = date.format(formatterToAdd) binding.textviewMedicalrecordaddSelectDate.text = date.format(formatter) + Log.d("MedicalRecordAddFragment", "Selected date: $addSelectedDate") } - } From a9d30f1daaaf21f49ef88fd3087f2b53faf13f8f Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 02:00:30 +0900 Subject: [PATCH 19/33] =?UTF-8?q?design:=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=96=89=EC=9D=98=20=EA=B8=B8=EC=9D=B4=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=9D=BC=20=EB=B0=95=EC=8A=A4=EC=9D=98=20=EC=84=B8=EB=A1=9C?= =?UTF-8?q?=EA=B8=B8=EC=9D=B4=EB=8F=84=20=EB=8F=99=EC=A0=81=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=ED=95=98=EA=B2=8C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/fragment_medical_record_add.xml | 141 +++++++++--------- 1 file changed, 73 insertions(+), 68 deletions(-) diff --git a/app/src/main/res/layout/fragment_medical_record_add.xml b/app/src/main/res/layout/fragment_medical_record_add.xml index d442d3f0..a0767ca6 100644 --- a/app/src/main/res/layout/fragment_medical_record_add.xml +++ b/app/src/main/res/layout/fragment_medical_record_add.xml @@ -136,11 +136,12 @@ android:background="@drawable/all_rect_r5" android:paddingVertical="11dp" android:paddingStart="16dp" - android:text="@string/all_select_date" + android:hint="@string/all_select_date" android:textAppearance="@style/Typography.Body1.Medium" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - android:textColor="@color/gray4" + android:textColor="@color/black" + android:textColorHint="@color/gray4" app:layout_constraintTop_toBottomOf="@id/textview_medicalrecordadd_date" /> - - - - - - + app:layout_constraintTop_toBottomOf="@+id/textview_medicalrecordadd_hospital" > + + + + + - + app:layout_constraintTop_toBottomOf="@id/textview_medicalrecordadd_note" > - + + + + + - From 37bb2639f2b6c1fec26107c0fa67c48f554e0e47 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 02:07:43 +0900 Subject: [PATCH 20/33] =?UTF-8?q?design:=20=ED=95=AD=EB=AA=A9=20id=20?= =?UTF-8?q?=EC=9A=A9=EB=8F=84=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/fragment_medical_record_add.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/layout/fragment_medical_record_add.xml b/app/src/main/res/layout/fragment_medical_record_add.xml index a0767ca6..20c67595 100644 --- a/app/src/main/res/layout/fragment_medical_record_add.xml +++ b/app/src/main/res/layout/fragment_medical_record_add.xml @@ -214,12 +214,12 @@ android:textColorHint="@color/gray4" android:hint="병원 이름" app:layout_constraintBottom_toBottomOf="@id/view_medicalrecordadd_hospital_name" - app:layout_constraintEnd_toStartOf="@id/edittext_medicalrecordadd_hospital_name_count" + app:layout_constraintEnd_toStartOf="@id/textview_medicalrecordadd_hospital_name_count" app:layout_constraintStart_toStartOf="@id/view_medicalrecordadd_hospital_name" app:layout_constraintTop_toTopOf="@id/view_medicalrecordadd_hospital_name" /> Date: Sat, 6 Apr 2024 02:09:02 +0900 Subject: [PATCH 21/33] =?UTF-8?q?feat:=20=EB=8F=99=EB=AC=BC=EB=B3=91?= =?UTF-8?q?=EC=9B=90=EC=9D=B4=EB=A6=84,=20=EB=8B=B4=EB=8B=B9=EC=9D=98=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84,=20=EB=85=B8=ED=8A=B8=20=ED=85=8D=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?=EA=B8=80=EC=9E=90=20=EC=88=98=20=EC=84=B8=EA=B8=B0=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/MedicalRecordAddFragment.kt | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) 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 b74f902e..4a843eac 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 @@ -1,12 +1,15 @@ package com.project.meongcare.medicalRecord.view import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager +import com.project.meongcare.R import com.project.meongcare.databinding.FragmentMedicalRecordAddBinding import com.project.meongcare.medicalRecord.view.bottomSheet.MedicalRecordDateBottomSheetDialogFragment import java.time.LocalDate @@ -29,6 +32,59 @@ class MedicalRecordAddFragment : Fragment(), override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) initDateBtn() + initHospitalName() + initVeterinarianName() + initNote() + } + + private fun initNote() { + binding.edittextMedicalrecordaddNoteDetail.addTextChangedListener(object : + TextWatcher { + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + } + + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + val textLength = s?.length ?: 0 + binding.textviewMedicalrecordaddNoteCount.text = + getString(R.string.medicalrecord_note_length, textLength) + } + + override fun afterTextChanged(s: Editable?) { + } + }) + } + + private fun initVeterinarianName() { + binding.edittextMedicalrecordaddVeterinarianName.addTextChangedListener(object : + TextWatcher { + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + } + + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + val textLength = s?.length ?: 0 + binding.textviewMedicalrecordaddVeterinarianNameCount.text = + getString(R.string.medicalrecord_veterinarian_name_length, textLength) + } + + override fun afterTextChanged(s: Editable?) { + } + }) + } + + private fun initHospitalName() { + binding.edittextMedicalrecordaddHospitalName.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + } + + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + val textLength = s?.length ?: 0 + binding.textviewMedicalrecordaddHospitalNameCount.text = + getString(R.string.medicalrecord_hospital_name_length, textLength) + } + + override fun afterTextChanged(s: Editable?) { + } + }) } private fun initDateBtn() { From c34392a8e47dd3c67b9c0de6c6683305e158c4a9 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 02:45:38 +0900 Subject: [PATCH 22/33] =?UTF-8?q?feat:=20=EC=82=AC=EC=A7=84=20=EA=B0=80?= =?UTF-8?q?=EC=A0=B8=EC=98=A4=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84(=EC=B9=B4=EB=A9=94=EB=9D=BC,=20=EC=95=A8=EB=B2=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/local/OnPictureChangedListener.kt | 7 ++++ .../view/MedicalRecordAddFragment.kt | 32 ++++++++++++++++++- ...lRecordPictureBottomSheetDialogFragment.kt | 2 +- app/src/main/res/xml/file_paths.xml | 4 +++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt new file mode 100644 index 00000000..ffddd79d --- /dev/null +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt @@ -0,0 +1,7 @@ +package com.project.meongcare.medicalRecord.model.data.local + +import android.net.Uri + +interface OnPictureChangedListener { + fun onPictureChanged(uri: Uri) +} \ No newline at end of file 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 4a843eac..8d491d96 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 @@ -1,5 +1,6 @@ package com.project.meongcare.medicalRecord.view +import android.net.Uri import android.os.Bundle import android.text.Editable import android.text.TextWatcher @@ -9,15 +10,21 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager +import androidx.fragment.app.viewModels +import com.bumptech.glide.Glide import com.project.meongcare.R import com.project.meongcare.databinding.FragmentMedicalRecordAddBinding +import com.project.meongcare.medicalRecord.model.data.local.OnPictureChangedListener import com.project.meongcare.medicalRecord.view.bottomSheet.MedicalRecordDateBottomSheetDialogFragment +import com.project.meongcare.medicalRecord.view.bottomSheet.MedicalRecordPictureBottomSheetDialogFragment +import com.project.meongcare.medicalRecord.viewmodel.MedicalRecordViewModel import java.time.LocalDate import java.time.format.DateTimeFormatter class MedicalRecordAddFragment : Fragment(), - MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener { + MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener, OnPictureChangedListener { private lateinit var binding: FragmentMedicalRecordAddBinding + private val medicalRecordViewModel: MedicalRecordViewModel by viewModels() private var addSelectedDate: String = "" override fun onCreateView( @@ -31,6 +38,10 @@ class MedicalRecordAddFragment : Fragment(), override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + binding.cardviewMedicalrecordaddImage.setOnClickListener { + showPictureBottomSheet() + } + initDateBtn() initHospitalName() initVeterinarianName() @@ -93,6 +104,17 @@ class MedicalRecordAddFragment : Fragment(), } } + private fun showPictureBottomSheet() { + val bottomSheetFragment = MedicalRecordPictureBottomSheetDialogFragment() + + bottomSheetFragment.setOnPictureChangedListener(this) + + bottomSheetFragment.show( + parentFragmentManager, + "MedicalRecordPictureBottomSheetDialogFragment", + ) + } + fun showCalendarBottomSheet( parentFragmentManager: FragmentManager, onDateSelectedListener: MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener, @@ -113,4 +135,12 @@ class MedicalRecordAddFragment : Fragment(), binding.textviewMedicalrecordaddSelectDate.text = date.format(formatter) Log.d("MedicalRecordAddFragment", "Selected date: $addSelectedDate") } + + override fun onPictureChanged(uri: Uri) { + Glide.with(this@MedicalRecordAddFragment) + .load(uri) + .into(binding.imageviewMedicalrecordaddImage) + binding.imageviewMedicalrecordaddImage.visibility = View.VISIBLE + binding.layoutMedicalrecordaddPictureSample.visibility = View.GONE + } } diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordPictureBottomSheetDialogFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordPictureBottomSheetDialogFragment.kt index 16b35323..6043e877 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordPictureBottomSheetDialogFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/bottomSheet/MedicalRecordPictureBottomSheetDialogFragment.kt @@ -15,8 +15,8 @@ import androidx.core.content.FileProvider import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment -import com.project.meongcare.OnPictureChangedListener import com.project.meongcare.databinding.BottomsheetMedicalRecordAddPictureBinding +import com.project.meongcare.medicalRecord.model.data.local.OnPictureChangedListener import java.io.File import java.text.SimpleDateFormat import java.util.Date diff --git a/app/src/main/res/xml/file_paths.xml b/app/src/main/res/xml/file_paths.xml index 1da163f5..69912330 100644 --- a/app/src/main/res/xml/file_paths.xml +++ b/app/src/main/res/xml/file_paths.xml @@ -19,4 +19,8 @@ + + From 4cbbf62418f8a538fd5dace1b1d14495d556f957 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 03:03:06 +0900 Subject: [PATCH 23/33] =?UTF-8?q?feat:=20=EC=82=AD=EC=A0=9C=20=EB=8B=A4?= =?UTF-8?q?=EC=9D=B4=EC=96=BC=EB=A1=9C=EA=B7=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/MedicalRecordInfoFragment.kt | 27 ++++++++++++++----- .../layout/fragment_medical_record_info.xml | 10 +++++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt index a40c8592..7f7f9902 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt @@ -38,10 +38,11 @@ class MedicalRecordInfoFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + //Todo: 전달받은 진료기록 아이디 연결, 액세스 토큰 userViewModel로 연결 medicalRecordId = 1 accessToken = - "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjMzMjE4Mn0.EVtsKue6RNJ9B_5imPJRHwg1VzhyCTfT0b5B7LObDKA" - + "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjM0MzYxOX0.qXPMWcqU8ZoLVwJEyxYd3WJFR8GgN0Tsr1fEg5jJgnA" + setMedicalRecord() getMedicalRecord() initBackBtn() @@ -50,12 +51,24 @@ class MedicalRecordInfoFragment : Fragment() { private fun initDeleteBtn() { binding.imagebuttonMedicalrecordinfoDelete.setOnClickListener { - medicalRecordViewModel.deleteMedicalRecordList( - intArrayOf(medicalRecordId.toInt()), - accessToken - ) + binding.includeMedicalrecordinfoDeleteDialog.root.visibility = View.VISIBLE + initDeleteDialog() + } + } + + private fun initDeleteDialog() { + binding.includeMedicalrecordinfoDeleteDialog.run { + buttonDeleteDialogCancel.setOnClickListener { + binding.includeMedicalrecordinfoDeleteDialog.root.visibility = View.GONE + } + buttonDeleteDialogDelete.setOnClickListener { + medicalRecordViewModel.deleteMedicalRecordList( + intArrayOf(medicalRecordId.toInt()), + accessToken + ) + isDeleteSuccess() + } } - isDeleteSuccess() } private fun isDeleteSuccess() { diff --git a/app/src/main/res/layout/fragment_medical_record_info.xml b/app/src/main/res/layout/fragment_medical_record_info.xml index a67620a0..611d1f35 100644 --- a/app/src/main/res/layout/fragment_medical_record_info.xml +++ b/app/src/main/res/layout/fragment_medical_record_info.xml @@ -319,5 +319,15 @@ + From c0c6165ac8ba745be9b5efda02614f644db4f612 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 03:30:14 +0900 Subject: [PATCH 24/33] =?UTF-8?q?refactor:=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20=EA=B4=80=EB=A6=AC=20=ED=95=A8=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../medicalrecord/view/MedicalRecordAddFragment.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 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 8d491d96..c8065a92 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 @@ -38,16 +38,19 @@ class MedicalRecordAddFragment : Fragment(), override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - binding.cardviewMedicalrecordaddImage.setOnClickListener { - showPictureBottomSheet() - } - + initImg() initDateBtn() initHospitalName() initVeterinarianName() initNote() } + private fun initImg() { + binding.cardviewMedicalrecordaddImage.setOnClickListener { + showPictureBottomSheet() + } + } + private fun initNote() { binding.edittextMedicalrecordaddNoteDetail.addTextChangedListener(object : TextWatcher { From ff9948bde1009f105a21f2215ca241c1f44a5f73 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 04:30:30 +0900 Subject: [PATCH 25/33] =?UTF-8?q?feat:=20=EC=A7=84=EB=A3=8C=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20post=20api=20=EA=B4=80=EB=A0=A8=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/data/remote/MedicalRecordApi.kt | 15 ++ .../repository/MedicalRecordRepository.kt | 9 ++ .../repository/MedicalRecordRepositoryImpl.kt | 18 +++ .../model/entities/MedicalRecordDto.kt | 9 ++ .../model/utils/MedicalRecordUtils.kt | 46 ++++++ .../viewmodel/MedicalRecordViewModel.kt | 135 ++++++++++++------ 6 files changed, 190 insertions(+), 42 deletions(-) create mode 100644 app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt index b182728e..87373ad6 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt @@ -2,10 +2,16 @@ package com.project.meongcare.medicalRecord.model.data.remote import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGetResponse +import okhttp3.MultipartBody +import okhttp3.RequestBody +import okhttp3.ResponseBody import retrofit2.Response import retrofit2.http.DELETE import retrofit2.http.GET import retrofit2.http.Header +import retrofit2.http.Multipart +import retrofit2.http.POST +import retrofit2.http.Part import retrofit2.http.Path import retrofit2.http.Query @@ -28,4 +34,13 @@ interface MedicalRecordApi { @Query("medicalRecordIds") medicalRecordIds: IntArray, @Header("AccessToken") accessToken: String, ): Response + + @Multipart + @POST("medical-record") + suspend fun addMedicalRecord( + @Header("AccessToken") accessToken: String?, + @Part filePart: MultipartBody.Part, + @Part("dto") medicalRecordDto: RequestBody, + ): Response + } diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt index 73a54359..741ef8d1 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt @@ -2,6 +2,10 @@ package com.project.meongcare.medicalRecord.model.data.repository 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.supplement.model.data.repository.SupplementRepository +import com.project.meongcare.supplement.model.entities.RequestSupplement +import okhttp3.ResponseBody import retrofit2.Response interface MedicalRecordRepository { @@ -20,4 +24,9 @@ interface MedicalRecordRepository { medicalRecordIds: IntArray, accessToken: String, ): Int? + + suspend fun addMedicalRecord( + accessToken: String?, + requestSupplement: RequestMedicalRecord, + ): Int } diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt index cdd5447c..da85f6b0 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt @@ -4,6 +4,10 @@ import android.util.Log import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet import com.project.meongcare.medicalRecord.model.data.remote.MedicalRecordRetrofitClient import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGetResponse +import com.project.meongcare.medicalRecord.model.entities.RequestMedicalRecord +import com.project.meongcare.supplement.model.data.repository.SupplementRepository +import com.project.meongcare.supplement.model.entities.RequestSupplement +import okhttp3.ResponseBody import org.json.JSONObject import retrofit2.Response import javax.inject.Inject @@ -69,4 +73,18 @@ class MedicalRecordRepositoryImpl null } } + + override suspend fun addMedicalRecord( + accessToken: String?, + requestSupplement: RequestMedicalRecord, + ): Int { + val response = + medicalRecordRetrofitClient.medicalRecordApi.addMedicalRecord( + accessToken, + requestSupplement.file, + requestSupplement.dto, + ) + return response.code() } + +} diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt new file mode 100644 index 00000000..f5c8ea3d --- /dev/null +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt @@ -0,0 +1,9 @@ +package com.project.meongcare.medicalRecord.model.entities + +data class MedicalRecordDto( + val dogId: Long, + val dateTime: String, + val hospitalName: String, + val doctorName: String, + val note: String, +) \ No newline at end of file diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt index d6be9907..439172b4 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt @@ -1,5 +1,19 @@ package com.project.meongcare.medicalRecord.model.utils +import android.content.Context +import android.net.Uri +import android.view.View +import android.view.inputmethod.InputMethodManager +import com.google.gson.Gson +import com.project.meongcare.medicalRecord.model.entities.MedicalRecord +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordDto +import com.project.meongcare.supplement.model.entities.SupplementDto +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.MultipartBody +import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.asRequestBody +import okhttp3.RequestBody.Companion.toRequestBody +import java.io.File import java.time.LocalDateTime import java.time.format.DateTimeFormatter import java.util.Locale @@ -21,5 +35,37 @@ class MedicalRecordUtils { val outputFormatter = DateTimeFormatter.ofPattern("a hh:mm", Locale.getDefault()) return dateTime.format(outputFormatter) } + + fun convertMedicalRecordDto(medicalRecordDto: MedicalRecordDto): RequestBody { + val json = Gson().toJson(medicalRecordDto) + return json.toRequestBody("application/json; charset=utf-8".toMediaTypeOrNull()) + } + + fun convertPictureToFile( + context: Context, + uri: Uri, + ): MultipartBody.Part { + if (uri.toString().isEmpty()) { + val emptyFile = "".toRequestBody("multipart/form-data".toMediaTypeOrNull()) + return MultipartBody.Part.createFormData("file", "", emptyFile) + } + + val inputStream = context.contentResolver.openInputStream(uri) + val file = File(context.cacheDir, "tempFile") + inputStream.use { input -> + file.outputStream().use { output -> + input?.copyTo(output) + } + } + val requestFile = file.asRequestBody("multipart/form-data".toMediaTypeOrNull()) + + return MultipartBody.Part.createFormData("file", file.name, requestFile) + } + + fun hideKeyboard(view: View) { + val inputMethodManager = + view.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) + } } } \ No newline at end of file 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 dbce8f44..0521d8c2 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 @@ -1,72 +1,123 @@ package com.project.meongcare.medicalRecord.viewmodel +import android.net.Uri +import android.util.Log import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.project.meongcare.home.model.data.local.DogPreferences +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.MedicalRecord +import com.project.meongcare.medicalRecord.model.entities.MedicalRecordDto 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.RequestSupplement +import com.project.meongcare.supplement.model.entities.SupplementDto +import com.project.meongcare.supplement.utils.SupplementUtils import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch import retrofit2.Response import javax.inject.Inject @HiltViewModel class MedicalRecordViewModel - @Inject - constructor( - private val medicalRecordRepositoryImpl: MedicalRecordRepositoryImpl, - ) : ViewModel() { - private val _medicalRecordList = MutableLiveData>() - val medicalRecordList: LiveData> - get() = _medicalRecordList +@Inject +constructor( + private val medicalRecordRepositoryImpl: MedicalRecordRepositoryImpl, +) : ViewModel() { + private val _medicalRecordList = MutableLiveData>() + val medicalRecordList: LiveData> + get() = _medicalRecordList - private val _medicalRecord = MutableLiveData>() - val medicalRecord: LiveData> + private val _medicalRecord = MutableLiveData>() + val medicalRecord: LiveData> get() = _medicalRecord - private val _selectedDate = MutableLiveData() - val selectedDate: LiveData - get() = _selectedDate + private val _selectedDate = MutableLiveData() + val selectedDate: LiveData + get() = _selectedDate - private val _deleteMedicalRecordResponse = MutableLiveData() - val deleteMedicalRecordResponse: LiveData - get() = _deleteMedicalRecordResponse + private val _deleteMedicalRecordResponse = MutableLiveData() + val deleteMedicalRecordResponse: LiveData + get() = _deleteMedicalRecordResponse - init { - _selectedDate.value = null - } + private val _medicalRecordAddResponse = MutableLiveData() + val medicalRecordAddResponse: LiveData + get() = _medicalRecordAddResponse + + init { + _selectedDate.value = null + } - fun getMedicalRecordList( - dogId: Long, - dateTime: String, - accessToken: String, - ) { - viewModelScope.launch { - _medicalRecordList.value = medicalRecordRepositoryImpl.getMedicalRecordList(dogId, dateTime, accessToken) - } + fun getMedicalRecordList( + dogId: Long, + dateTime: String, + accessToken: String, + ) { + viewModelScope.launch { + _medicalRecordList.value = + medicalRecordRepositoryImpl.getMedicalRecordList(dogId, dateTime, accessToken) } + } - fun getMedicalRecord( - medicalRecordId: Long, - accessToken: String, - ) { - viewModelScope.launch { - _medicalRecord.value = medicalRecordRepositoryImpl.getMedicalRecord(medicalRecordId, accessToken) - } + fun getMedicalRecord( + medicalRecordId: Long, + accessToken: String, + ) { + viewModelScope.launch { + _medicalRecord.value = + medicalRecordRepositoryImpl.getMedicalRecord(medicalRecordId, accessToken) } + } - fun getCurrentDate(date: String?) { - _selectedDate.value = date + fun getCurrentDate(date: String?) { + _selectedDate.value = date + } + + fun deleteMedicalRecordList( + medicalRecordIds: IntArray, + accessToken: String, + ) { + viewModelScope.launch { + _deleteMedicalRecordResponse.value = + medicalRecordRepositoryImpl.deleteMedicalRecordList(medicalRecordIds, accessToken) } + } + + fun addMedicalRecord( + dateTime: String, + hospitalName: String, + doctorName: String, + note: String, + uri: Uri, + ) { + viewModelScope.launch { +// val accessToken: String? = +// UserPreferences(GlobalApplication.applicationContext()).accessToken.first() +// val dogId: Long? = DogPreferences(GlobalApplication.applicationContext()).dogId.first() + val accessToken ="Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjM0NTIwNH0.qVQGygykhhuu2O2op5Q7abe67z8YJNbHuuKS76EWtiY" + val dogId: Long = 6 + + val medicalRecordDto = + MedicalRecordDto(dogId!!, dateTime, hospitalName, doctorName, note) + val dto = MedicalRecordUtils.convertMedicalRecordDto(medicalRecordDto) + val file = + MedicalRecordUtils.convertPictureToFile(GlobalApplication.applicationContext(), uri) - fun deleteMedicalRecordList( - medicalRecordIds: IntArray, - accessToken: String, - ) { - viewModelScope.launch { - _deleteMedicalRecordResponse.value = medicalRecordRepositoryImpl.deleteMedicalRecordList(medicalRecordIds, accessToken) - } + val requestMedicalRecord = + RequestMedicalRecord( + dto, + file, + ) + Log.d("진료기록 추가 확인", medicalRecordDto.toString()) + _medicalRecordAddResponse.value = medicalRecordRepositoryImpl.addMedicalRecord(accessToken, requestMedicalRecord) + Log.d("진료기록 추가 확인2", medicalRecordAddResponse.value.toString()) } } +} From 6d01efba8b718b935212bf152089d3a3662b5149 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 04:33:06 +0900 Subject: [PATCH 26/33] =?UTF-8?q?refactor:=20=EB=A7=A4=EA=B0=9C=20?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/data/repository/MedicalRecordRepositoryImpl.kt | 6 +++--- .../medicalrecord/model/entities/RequestMedicalRecord.kt | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt index da85f6b0..e27afff8 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt @@ -76,13 +76,13 @@ class MedicalRecordRepositoryImpl override suspend fun addMedicalRecord( accessToken: String?, - requestSupplement: RequestMedicalRecord, + requestMedicalRecord: RequestMedicalRecord, ): Int { val response = medicalRecordRetrofitClient.medicalRecordApi.addMedicalRecord( accessToken, - requestSupplement.file, - requestSupplement.dto, + requestMedicalRecord.file, + requestMedicalRecord.dto, ) return response.code() } diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt new file mode 100644 index 00000000..84fa7a07 --- /dev/null +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt @@ -0,0 +1,9 @@ +package com.project.meongcare.medicalRecord.model.entities + +import okhttp3.MultipartBody +import okhttp3.RequestBody + +data class RequestMedicalRecord( + val dto: RequestBody, + val file: MultipartBody.Part, +) \ No newline at end of file From 2b0ce7bab040b2bf46b991063778261446bcb22c Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 04:55:47 +0900 Subject: [PATCH 27/33] =?UTF-8?q?feat:=20null=20=EC=B2=B4=ED=81=AC=20?= =?UTF-8?q?=ED=9B=84=20null=EC=9D=BC=20=EC=8B=9C=20=EA=B2=BD=EA=B3=A0=20?= =?UTF-8?q?=EB=94=94=EC=9E=90=EC=9D=B8=20=EB=B3=B4=EC=97=AC=EC=A7=80?= =?UTF-8?q?=EA=B2=8C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/MedicalRecordAddFragment.kt | 83 ++++++++++++++++ .../layout/fragment_medical_record_add.xml | 99 ++++++++++--------- 2 files changed, 133 insertions(+), 49 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 c8065a92..fe9838f6 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 @@ -1,5 +1,6 @@ package com.project.meongcare.medicalRecord.view +import android.content.Context.INPUT_METHOD_SERVICE import android.net.Uri import android.os.Bundle import android.text.Editable @@ -8,13 +9,21 @@ import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.view.inputmethod.InputMethodManager +import android.widget.EditText +import android.widget.TextView +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.content.ContextCompat +import androidx.core.content.ContextCompat.getSystemService import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.viewModels import com.bumptech.glide.Glide +import com.project.meongcare.MainActivity import com.project.meongcare.R import com.project.meongcare.databinding.FragmentMedicalRecordAddBinding import com.project.meongcare.medicalRecord.model.data.local.OnPictureChangedListener +import com.project.meongcare.medicalRecord.model.utils.MedicalRecordUtils import com.project.meongcare.medicalRecord.view.bottomSheet.MedicalRecordDateBottomSheetDialogFragment import com.project.meongcare.medicalRecord.view.bottomSheet.MedicalRecordPictureBottomSheetDialogFragment import com.project.meongcare.medicalRecord.viewmodel.MedicalRecordViewModel @@ -24,6 +33,7 @@ import java.time.format.DateTimeFormatter class MedicalRecordAddFragment : Fragment(), MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener, OnPictureChangedListener { private lateinit var binding: FragmentMedicalRecordAddBinding + private lateinit var mainActivity: MainActivity private val medicalRecordViewModel: MedicalRecordViewModel by viewModels() private var addSelectedDate: String = "" @@ -33,6 +43,7 @@ class MedicalRecordAddFragment : Fragment(), savedInstanceState: Bundle?, ): View { binding = FragmentMedicalRecordAddBinding.inflate(inflater) + mainActivity = activity as MainActivity return binding.root } @@ -43,6 +54,75 @@ class MedicalRecordAddFragment : Fragment(), initHospitalName() initVeterinarianName() initNote() + binding.layoutMedicalrecordaddNoteRecord.buttonFooterone.setOnClickListener { + checkMedicalRecordDataNull() + } + } + + private fun checkMedicalRecordDataNull() { + if (addSelectedDate.isNullOrEmpty()) { + isDateNullOrEmpty() + } + + if (binding.edittextMedicalrecordaddHospitalName.text.isNullOrBlank()) { + val editText = binding.edittextMedicalrecordaddHospitalName + val layout = binding.layoutMedicalrecordaddHospitalName + val count = binding.textviewMedicalrecordaddHospitalNameCount + isEditTextNullOrEmpty(editText, layout, count) + } + + if (binding.edittextMedicalrecordaddVeterinarianName.text.isNullOrBlank()) { + val editText = binding.edittextMedicalrecordaddVeterinarianName + val layout = binding.layoutMedicalrecordaddVeterinarianName + val count = binding.textviewMedicalrecordaddVeterinarianNameCount + isEditTextNullOrEmpty(editText, layout, count) + } + + if (binding.edittextMedicalrecordaddNoteDetail.text.isNullOrBlank()) { + val editText = binding.edittextMedicalrecordaddNoteDetail + val layout = binding.layoutMedicalrecordaddNote + val count = binding.textviewMedicalrecordaddNoteCount + isEditTextNullOrEmpty(editText, layout, count) + } + } + + private fun isDateNullOrEmpty() { + binding.textviewMedicalrecordaddSelectDate.run { + text = "필수 입력 값입니다." + binding.imageviewMedicalrecordaddSelectDate.visibility = View.INVISIBLE + setTextAppearance(R.style.Typography_Body1_Regular) + setTextColor(ContextCompat.getColor(mainActivity, R.color.sub1)) + setBackgroundResource(R.drawable.all_rect_gray1_r5_outline_sub1) + } + } + + fun isEditTextNullOrEmpty(editText: EditText, layout: ConstraintLayout?, textCount: TextView) { + layout!!.setBackgroundResource(R.drawable.all_rect_gray1_r5_outline_sub1) + textCount.visibility = View.INVISIBLE + editText.run { + setHintTextColor(ContextCompat.getColor(mainActivity, R.color.sub1)) + hint = "필수 입력 값입니다" + } + MedicalRecordUtils.hideKeyboard(editText) + } + + private fun setAddMode(view: Any, layout: ConstraintLayout?, textCount: TextView?) { + when (view) { + is TextView -> { + view.setTextColor(ContextCompat.getColor(mainActivity, R.color.black)) + view.setTextAppearance(R.style.Typography_Body1_Medium) + view.setBackgroundResource(R.drawable.all_rect_r5) + } + + is EditText -> { + layout!!.setBackgroundResource(R.drawable.all_rect_r5) + view.setHintTextColor(ContextCompat.getColor(mainActivity, R.color.black)) + view.hint = "" + textCount!!.visibility = View.VISIBLE + } + + else -> throw IllegalArgumentException("Unsupported view type") + } } private fun initImg() { @@ -130,12 +210,15 @@ class MedicalRecordAddFragment : Fragment(), ) } + override fun onDateSelected(date: LocalDate) { val formatter = DateTimeFormatter.ofPattern("yyyy년 M월 d일") val formatterToAdd = DateTimeFormatter.ofPattern("yyyy-MM-dd") // val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'00:00:00") addSelectedDate = date.format(formatterToAdd) + setAddMode(binding.textviewMedicalrecordaddSelectDate, null, null) binding.textviewMedicalrecordaddSelectDate.text = date.format(formatter) + Log.d("MedicalRecordAddFragment", "Selected date: $addSelectedDate") } diff --git a/app/src/main/res/layout/fragment_medical_record_add.xml b/app/src/main/res/layout/fragment_medical_record_add.xml index 20c67595..b6d249fe 100644 --- a/app/src/main/res/layout/fragment_medical_record_add.xml +++ b/app/src/main/res/layout/fragment_medical_record_add.xml @@ -69,6 +69,7 @@ app:layout_constraintTop_toTopOf="parent"> + app:layout_constraintStart_toStartOf="@id/layout_medicalrecordadd_hospital_name" + app:layout_constraintTop_toTopOf="@id/layout_medicalrecordadd_hospital_name" /> @@ -243,7 +244,7 @@ android:text="@string/medicalrecord_veterinarian" android:textAppearance="@style/Typography.Title3.SemiBold" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/view_medicalrecordadd_hospital_name" /> + app:layout_constraintTop_toBottomOf="@+id/layout_medicalrecordadd_hospital_name" /> - - - + app:layout_constraintTop_toBottomOf="@id/textview_medicalrecordadd_veterinarian" > + - + + + app:layout_constraintTop_toBottomOf="@+id/layout_medicalrecordadd_veterinarian_name" /> + app:layout_constraintStart_toStartOf="@id/layout_medicalrecordadd_note" + app:layout_constraintTop_toTopOf="@id/layout_medicalrecordadd_note" /> From ad3599721f01385df68557c0fe609da04c61ac82 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 04:57:49 +0900 Subject: [PATCH 28/33] =?UTF-8?q?design:=20=EC=A7=84=EB=A3=8C=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=A0=95=EB=B3=B4,=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/navigation/nav_graph.xml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index 0ca5a0bb..7ed47482 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -227,7 +227,7 @@ android:id="@+id/action_excretaRecordEditFragment_to_excretaFragment" app:destination="@id/excretaFragment" /> - + + + + + @@ -331,7 +343,7 @@ android:id="@+id/action_settingFragment_to_loginFragment" app:destination="@id/loginFragment" /> - + Date: Sat, 6 Apr 2024 05:08:58 +0900 Subject: [PATCH 29/33] =?UTF-8?q?refactor:=20=EC=93=B0=EC=A7=80=EC=95=8A?= =?UTF-8?q?=EC=9D=80=20=EC=9E=84=ED=8F=AC=ED=8A=B8=EB=AC=B8=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0,=20=EA=B0=84=EA=B2=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewmodel/MedicalRecordViewModel.kt | 163 +++++++++--------- 1 file changed, 79 insertions(+), 84 deletions(-) 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 0521d8c2..3cddfd78 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,118 +6,113 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.project.meongcare.home.model.data.local.DogPreferences -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.MedicalRecord import com.project.meongcare.medicalRecord.model.entities.MedicalRecordDto 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.RequestSupplement -import com.project.meongcare.supplement.model.entities.SupplementDto -import com.project.meongcare.supplement.utils.SupplementUtils import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch import retrofit2.Response import javax.inject.Inject @HiltViewModel class MedicalRecordViewModel -@Inject -constructor( - private val medicalRecordRepositoryImpl: MedicalRecordRepositoryImpl, -) : ViewModel() { - private val _medicalRecordList = MutableLiveData>() - val medicalRecordList: LiveData> - get() = _medicalRecordList + @Inject + constructor( + private val medicalRecordRepositoryImpl: MedicalRecordRepositoryImpl, + ) : ViewModel() { + private val _medicalRecordList = MutableLiveData>() + val medicalRecordList: LiveData> + get() = _medicalRecordList - private val _medicalRecord = MutableLiveData>() - val medicalRecord: LiveData> - get() = _medicalRecord + private val _medicalRecord = MutableLiveData>() + val medicalRecord: LiveData> + get() = _medicalRecord - private val _selectedDate = MutableLiveData() - val selectedDate: LiveData - get() = _selectedDate + private val _selectedDate = MutableLiveData() + val selectedDate: LiveData + get() = _selectedDate - private val _deleteMedicalRecordResponse = MutableLiveData() - val deleteMedicalRecordResponse: LiveData - get() = _deleteMedicalRecordResponse + private val _deleteMedicalRecordResponse = MutableLiveData() + val deleteMedicalRecordResponse: LiveData + get() = _deleteMedicalRecordResponse - private val _medicalRecordAddResponse = MutableLiveData() - val medicalRecordAddResponse: LiveData - get() = _medicalRecordAddResponse + private val _medicalRecordAddResponse = MutableLiveData() + val medicalRecordAddResponse: LiveData + get() = _medicalRecordAddResponse - init { - _selectedDate.value = null - } + init { + _selectedDate.value = null + } - fun getMedicalRecordList( - dogId: Long, - dateTime: String, - accessToken: String, - ) { - viewModelScope.launch { - _medicalRecordList.value = - medicalRecordRepositoryImpl.getMedicalRecordList(dogId, dateTime, accessToken) + fun getMedicalRecordList( + dogId: Long, + dateTime: String, + accessToken: String, + ) { + viewModelScope.launch { + _medicalRecordList.value = + medicalRecordRepositoryImpl.getMedicalRecordList(dogId, dateTime, accessToken) + } } - } - fun getMedicalRecord( - medicalRecordId: Long, - accessToken: String, - ) { - viewModelScope.launch { - _medicalRecord.value = - medicalRecordRepositoryImpl.getMedicalRecord(medicalRecordId, accessToken) + fun getMedicalRecord( + medicalRecordId: Long, + accessToken: String, + ) { + viewModelScope.launch { + _medicalRecord.value = + medicalRecordRepositoryImpl.getMedicalRecord(medicalRecordId, accessToken) + } } - } - fun getCurrentDate(date: String?) { - _selectedDate.value = date - } + fun getCurrentDate(date: String?) { + _selectedDate.value = date + } - fun deleteMedicalRecordList( - medicalRecordIds: IntArray, - accessToken: String, - ) { - viewModelScope.launch { - _deleteMedicalRecordResponse.value = - medicalRecordRepositoryImpl.deleteMedicalRecordList(medicalRecordIds, accessToken) + fun deleteMedicalRecordList( + medicalRecordIds: IntArray, + accessToken: String, + ) { + viewModelScope.launch { + _deleteMedicalRecordResponse.value = + medicalRecordRepositoryImpl.deleteMedicalRecordList(medicalRecordIds, accessToken) + } } - } - fun addMedicalRecord( - dateTime: String, - hospitalName: String, - doctorName: String, - note: String, - uri: Uri, - ) { - viewModelScope.launch { -// val accessToken: String? = -// UserPreferences(GlobalApplication.applicationContext()).accessToken.first() -// val dogId: Long? = DogPreferences(GlobalApplication.applicationContext()).dogId.first() - val accessToken ="Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjM0NTIwNH0.qVQGygykhhuu2O2op5Q7abe67z8YJNbHuuKS76EWtiY" - val dogId: Long = 6 + fun addMedicalRecord( + dateTime: String, + hospitalName: String, + doctorName: String, + note: String, + uri: Uri, + ) { + viewModelScope.launch { + // val accessToken: String? = + // UserPreferences(GlobalApplication.applicationContext()).accessToken.first() + // val dogId: Long? = DogPreferences(GlobalApplication.applicationContext()).dogId.first() + val accessToken = + "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjM0NTIwNH0.qVQGygykhhuu2O2op5Q7abe67z8YJNbHuuKS76EWtiY" + val dogId: Long = 6 - val medicalRecordDto = - MedicalRecordDto(dogId!!, dateTime, hospitalName, doctorName, note) - val dto = MedicalRecordUtils.convertMedicalRecordDto(medicalRecordDto) - val file = - MedicalRecordUtils.convertPictureToFile(GlobalApplication.applicationContext(), uri) + val medicalRecordDto = + MedicalRecordDto(dogId, dateTime, hospitalName, doctorName, note) + val dto = MedicalRecordUtils.convertMedicalRecordDto(medicalRecordDto) + val file = + MedicalRecordUtils.convertPictureToFile(GlobalApplication.applicationContext(), uri) - val requestMedicalRecord = - RequestMedicalRecord( - dto, - file, - ) - Log.d("진료기록 추가 확인", medicalRecordDto.toString()) - _medicalRecordAddResponse.value = medicalRecordRepositoryImpl.addMedicalRecord(accessToken, requestMedicalRecord) - Log.d("진료기록 추가 확인2", medicalRecordAddResponse.value.toString()) + val requestMedicalRecord = + RequestMedicalRecord( + dto, + file, + ) + Log.d("진료기록 추가 확인", medicalRecordDto.toString()) + _medicalRecordAddResponse.value = + medicalRecordRepositoryImpl.addMedicalRecord(accessToken, requestMedicalRecord) + Log.d("진료기록 추가 확인2", medicalRecordAddResponse.value.toString()) + } } } -} From 90c28f2656b7ae5b77899b723217ebdae1d394ee Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 05:22:04 +0900 Subject: [PATCH 30/33] =?UTF-8?q?refactor:=20=EC=BD=94=ED=8B=80=EB=A6=B0?= =?UTF-8?q?=20=EC=BB=A8=EB=B2=A4=EC=85=98=EC=97=90=20=EB=A7=9E=EC=B6=B0=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/local/OnPictureChangedListener.kt | 1 + .../model/data/remote/MedicalRecordApi.kt | 1 - .../repository/MedicalRecordRepository.kt | 3 - .../repository/MedicalRecordRepositoryImpl.kt | 84 +++++++++---------- .../model/entities/MedicalRecordDto.kt | 3 +- .../model/entities/RequestMedicalRecord.kt | 3 +- .../model/utils/MedicalRecordUtils.kt | 3 +- .../view/MedicalRecordAddFragment.kt | 64 ++++++++++---- 8 files changed, 96 insertions(+), 66 deletions(-) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt index ffddd79d..60848935 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt @@ -4,4 +4,5 @@ import android.net.Uri interface OnPictureChangedListener { fun onPictureChanged(uri: Uri) + } \ No newline at end of file diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt index 87373ad6..2a3141eb 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/remote/MedicalRecordApi.kt @@ -42,5 +42,4 @@ interface MedicalRecordApi { @Part filePart: MultipartBody.Part, @Part("dto") medicalRecordDto: RequestBody, ): Response - } diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt index 741ef8d1..1d107432 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepository.kt @@ -3,9 +3,6 @@ package com.project.meongcare.medicalRecord.model.data.repository 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.supplement.model.data.repository.SupplementRepository -import com.project.meongcare.supplement.model.entities.RequestSupplement -import okhttp3.ResponseBody import retrofit2.Response interface MedicalRecordRepository { diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt index e27afff8..b32c6dcf 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt @@ -5,9 +5,6 @@ import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGet import com.project.meongcare.medicalRecord.model.data.remote.MedicalRecordRetrofitClient import com.project.meongcare.medicalRecord.model.entities.MedicalRecordGetResponse import com.project.meongcare.medicalRecord.model.entities.RequestMedicalRecord -import com.project.meongcare.supplement.model.data.repository.SupplementRepository -import com.project.meongcare.supplement.model.entities.RequestSupplement -import okhttp3.ResponseBody import org.json.JSONObject import retrofit2.Response import javax.inject.Inject @@ -35,38 +32,18 @@ class MedicalRecordRepositoryImpl } } - override suspend fun getMedicalRecord( - medicalRecordId: Long, - accessToken: String - ): Response? { - return try { - val response = medicalRecordRetrofitClient.medicalRecordApi.getMedicalRecord(medicalRecordId, accessToken) - if (response.isSuccessful) { - Log.d("MedicalRepo-Get", "통신 성공 : ${response.code()}") - response - } else { - Log.d("MedicalRepo-Get", "통신 실패 : ${response.code()}") - response - } - } catch (e: Exception) { - e.printStackTrace() - null - } - } - - override suspend fun deleteMedicalRecordList( - medicalRecordIds: IntArray, - accessToken: String, - ): Int? { + override suspend fun getMedicalRecord( + medicalRecordId: Long, + accessToken: String + ): Response? { return try { - val response = medicalRecordRetrofitClient.medicalRecordApi.deleteMedicalRecordList(medicalRecordIds, accessToken) + val response = medicalRecordRetrofitClient.medicalRecordApi.getMedicalRecord(medicalRecordId, accessToken) if (response.isSuccessful) { - Log.d("MedicalRepo-DeleteList", "통신 성공 : ${response.code()}") - response.code() + Log.d("MedicalRepo-Get", "통신 성공 : ${response.code()}") + response } else { - val stringToJson = JSONObject(response.errorBody()?.string()) - Log.d("MedicalRepo-DeleteList", "통신 실패 : ${response.code()} \n$stringToJson") - response.code() + Log.d("MedicalRepo-Get", "통신 실패 : ${response.code()}") + response } } catch (e: Exception) { e.printStackTrace() @@ -74,17 +51,36 @@ class MedicalRecordRepositoryImpl } } - override suspend fun addMedicalRecord( - accessToken: String?, - requestMedicalRecord: RequestMedicalRecord, - ): Int { - val response = - medicalRecordRetrofitClient.medicalRecordApi.addMedicalRecord( - accessToken, - requestMedicalRecord.file, - requestMedicalRecord.dto, - ) - return response.code() - } + override suspend fun deleteMedicalRecordList( + medicalRecordIds: IntArray, + accessToken: String, + ): Int? { + return try { + val response = medicalRecordRetrofitClient.medicalRecordApi.deleteMedicalRecordList(medicalRecordIds, accessToken) + if (response.isSuccessful) { + Log.d("MedicalRepo-DeleteList", "통신 성공 : ${response.code()}") + response.code() + } else { + val stringToJson = JSONObject(response.errorBody()?.string()) + Log.d("MedicalRepo-DeleteList", "통신 실패 : ${response.code()} \n$stringToJson") + response.code() + } + } catch (e: Exception) { + e.printStackTrace() + null + } + } + override suspend fun addMedicalRecord( + accessToken: String?, + requestMedicalRecord: RequestMedicalRecord, + ): Int { + val response = + medicalRecordRetrofitClient.medicalRecordApi.addMedicalRecord( + accessToken, + requestMedicalRecord.file, + requestMedicalRecord.dto, + ) + return response.code() + } } diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt index f5c8ea3d..dd237b14 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt @@ -6,4 +6,5 @@ data class MedicalRecordDto( val hospitalName: String, val doctorName: String, val note: String, -) \ No newline at end of file + + ) \ No newline at end of file diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt index 84fa7a07..fa3befa6 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt @@ -6,4 +6,5 @@ import okhttp3.RequestBody data class RequestMedicalRecord( val dto: RequestBody, val file: MultipartBody.Part, -) \ No newline at end of file + + ) \ No newline at end of file diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt index 439172b4..4a4c0b69 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt @@ -5,9 +5,7 @@ import android.net.Uri import android.view.View import android.view.inputmethod.InputMethodManager import com.google.gson.Gson -import com.project.meongcare.medicalRecord.model.entities.MedicalRecord import com.project.meongcare.medicalRecord.model.entities.MedicalRecordDto -import com.project.meongcare.supplement.model.entities.SupplementDto import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MultipartBody import okhttp3.RequestBody @@ -68,4 +66,5 @@ class MedicalRecordUtils { inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) } } + } \ No newline at end of file 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 fe9838f6..a7cfb8cd 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 @@ -1,6 +1,5 @@ package com.project.meongcare.medicalRecord.view -import android.content.Context.INPUT_METHOD_SERVICE import android.net.Uri import android.os.Bundle import android.text.Editable @@ -9,12 +8,10 @@ import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.view.inputmethod.InputMethodManager import android.widget.EditText import android.widget.TextView import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat -import androidx.core.content.ContextCompat.getSystemService import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.viewModels @@ -47,7 +44,10 @@ class MedicalRecordAddFragment : Fragment(), return binding.root } - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + override fun onViewCreated( + view: View, + savedInstanceState: Bundle?, + ) { super.onViewCreated(view, savedInstanceState) initImg() initDateBtn() @@ -96,7 +96,10 @@ class MedicalRecordAddFragment : Fragment(), } } - fun isEditTextNullOrEmpty(editText: EditText, layout: ConstraintLayout?, textCount: TextView) { + fun isEditTextNullOrEmpty( + editText: EditText, + layout: ConstraintLayout?, + textCount: TextView) { layout!!.setBackgroundResource(R.drawable.all_rect_gray1_r5_outline_sub1) textCount.visibility = View.INVISIBLE editText.run { @@ -106,7 +109,11 @@ class MedicalRecordAddFragment : Fragment(), MedicalRecordUtils.hideKeyboard(editText) } - private fun setAddMode(view: Any, layout: ConstraintLayout?, textCount: TextView?) { + private fun setAddMode( + view: Any, + layout: ConstraintLayout?, + textCount: TextView?, + ) { when (view) { is TextView -> { view.setTextColor(ContextCompat.getColor(mainActivity, R.color.black)) @@ -134,10 +141,20 @@ class MedicalRecordAddFragment : Fragment(), private fun initNote() { binding.edittextMedicalrecordaddNoteDetail.addTextChangedListener(object : TextWatcher { - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + override fun beforeTextChanged( + s: CharSequence?, + start: Int, + count: Int, + after: Int, + ) { } - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + override fun onTextChanged( + s: CharSequence?, + start: Int, + before: Int, + count: Int, + ) { val textLength = s?.length ?: 0 binding.textviewMedicalrecordaddNoteCount.text = getString(R.string.medicalrecord_note_length, textLength) @@ -151,10 +168,20 @@ class MedicalRecordAddFragment : Fragment(), private fun initVeterinarianName() { binding.edittextMedicalrecordaddVeterinarianName.addTextChangedListener(object : TextWatcher { - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + override fun beforeTextChanged( + s: CharSequence?, + start: Int, + count: Int, + after: Int, + ) { } - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + override fun onTextChanged( + s: CharSequence?, + start: Int, + before: Int, + count: Int, + ) { val textLength = s?.length ?: 0 binding.textviewMedicalrecordaddVeterinarianNameCount.text = getString(R.string.medicalrecord_veterinarian_name_length, textLength) @@ -167,10 +194,20 @@ class MedicalRecordAddFragment : Fragment(), private fun initHospitalName() { binding.edittextMedicalrecordaddHospitalName.addTextChangedListener(object : TextWatcher { - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + override fun beforeTextChanged( + s: CharSequence?, + start: Int, + count: Int, + after: Int, + ) { } - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + override fun onTextChanged( + s: CharSequence?, + start: Int, + before: Int, + count: Int, + ) { val textLength = s?.length ?: 0 binding.textviewMedicalrecordaddHospitalNameCount.text = getString(R.string.medicalrecord_hospital_name_length, textLength) @@ -206,11 +243,10 @@ class MedicalRecordAddFragment : Fragment(), bottomSheetDialogFragment.setOnDateSelecetedListener(onDateSelectedListener) bottomSheetDialogFragment.show( parentFragmentManager, - "MedicalRecordDateBottomSheetDialogFragment" + "MedicalRecordDateBottomSheetDialogFragment", ) } - override fun onDateSelected(date: LocalDate) { val formatter = DateTimeFormatter.ofPattern("yyyy년 M월 d일") val formatterToAdd = DateTimeFormatter.ofPattern("yyyy-MM-dd") From 0f85d532a19599ec2b39bd2bf5b94ffd0a47e359 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 05:30:09 +0900 Subject: [PATCH 31/33] =?UTF-8?q?refactor:=20=EC=BD=94=ED=8B=80=EB=A6=B0?= =?UTF-8?q?=20=EC=BB=A8=EB=B2=A4=EC=85=98=EC=97=90=20=EB=A7=9E=EC=B6=B0=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/local/OnPictureChangedListener.kt | 3 +- .../repository/MedicalRecordRepositoryImpl.kt | 36 +++++++++---------- .../model/entities/MedicalRecordDto.kt | 3 +- .../model/entities/RequestMedicalRecord.kt | 3 +- .../model/utils/MedicalRecordUtils.kt | 3 +- .../view/MedicalRecordAddFragment.kt | 20 ++++++----- .../view/MedicalRecordInfoFragment.kt | 10 +++--- 7 files changed, 40 insertions(+), 38 deletions(-) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt index 60848935..d092b4ca 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt @@ -4,5 +4,4 @@ import android.net.Uri interface OnPictureChangedListener { fun onPictureChanged(uri: Uri) - -} \ No newline at end of file +} diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt index b32c6dcf..52eb2cbb 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordRepositoryImpl.kt @@ -34,7 +34,7 @@ class MedicalRecordRepositoryImpl override suspend fun getMedicalRecord( medicalRecordId: Long, - accessToken: String + accessToken: String, ): Response? { return try { val response = medicalRecordRetrofitClient.medicalRecordApi.getMedicalRecord(medicalRecordId, accessToken) @@ -52,24 +52,24 @@ class MedicalRecordRepositoryImpl } override suspend fun deleteMedicalRecordList( - medicalRecordIds: IntArray, - accessToken: String, - ): Int? { - return try { - val response = medicalRecordRetrofitClient.medicalRecordApi.deleteMedicalRecordList(medicalRecordIds, accessToken) - if (response.isSuccessful) { - Log.d("MedicalRepo-DeleteList", "통신 성공 : ${response.code()}") - response.code() - } else { - val stringToJson = JSONObject(response.errorBody()?.string()) - Log.d("MedicalRepo-DeleteList", "통신 실패 : ${response.code()} \n$stringToJson") - response.code() - } - } catch (e: Exception) { - e.printStackTrace() - null + medicalRecordIds: IntArray, + accessToken: String, + ): Int? { + return try { + val response = medicalRecordRetrofitClient.medicalRecordApi.deleteMedicalRecordList(medicalRecordIds, accessToken) + if (response.isSuccessful) { + Log.d("MedicalRepo-DeleteList", "통신 성공 : ${response.code()}") + response.code() + } else { + val stringToJson = JSONObject(response.errorBody()?.string()) + Log.d("MedicalRepo-DeleteList", "통신 실패 : ${response.code()} \n$stringToJson") + response.code() } + } catch (e: Exception) { + e.printStackTrace() + null } + } override suspend fun addMedicalRecord( accessToken: String?, @@ -83,4 +83,4 @@ class MedicalRecordRepositoryImpl ) return response.code() } -} + } diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt index dd237b14..1fd01f3a 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt @@ -6,5 +6,4 @@ data class MedicalRecordDto( val hospitalName: String, val doctorName: String, val note: String, - - ) \ No newline at end of file +) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt index fa3befa6..28a26c84 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt @@ -6,5 +6,4 @@ import okhttp3.RequestBody data class RequestMedicalRecord( val dto: RequestBody, val file: MultipartBody.Part, - - ) \ No newline at end of file +) diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt index 4a4c0b69..8dc86dbc 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt @@ -66,5 +66,4 @@ class MedicalRecordUtils { inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) } } - -} \ No newline at end of file +} 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 a7cfb8cd..2552d75a 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 @@ -27,8 +27,10 @@ import com.project.meongcare.medicalRecord.viewmodel.MedicalRecordViewModel import java.time.LocalDate import java.time.format.DateTimeFormatter -class MedicalRecordAddFragment : Fragment(), - MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener, OnPictureChangedListener { +class MedicalRecordAddFragment : + Fragment(), + MedicalRecordDateBottomSheetDialogFragment.OnDateSelectedListener, + OnPictureChangedListener { private lateinit var binding: FragmentMedicalRecordAddBinding private lateinit var mainActivity: MainActivity private val medicalRecordViewModel: MedicalRecordViewModel by viewModels() @@ -99,7 +101,8 @@ class MedicalRecordAddFragment : Fragment(), fun isEditTextNullOrEmpty( editText: EditText, layout: ConstraintLayout?, - textCount: TextView) { + textCount: TextView, + ) { layout!!.setBackgroundResource(R.drawable.all_rect_gray1_r5_outline_sub1) textCount.visibility = View.INVISIBLE editText.run { @@ -139,8 +142,8 @@ class MedicalRecordAddFragment : Fragment(), } private fun initNote() { - binding.edittextMedicalrecordaddNoteDetail.addTextChangedListener(object : - TextWatcher { + binding.edittextMedicalrecordaddNoteDetail.addTextChangedListener( + object : TextWatcher { override fun beforeTextChanged( s: CharSequence?, start: Int, @@ -166,8 +169,8 @@ class MedicalRecordAddFragment : Fragment(), } private fun initVeterinarianName() { - binding.edittextMedicalrecordaddVeterinarianName.addTextChangedListener(object : - TextWatcher { + binding.edittextMedicalrecordaddVeterinarianName.addTextChangedListener( + object : TextWatcher { override fun beforeTextChanged( s: CharSequence?, start: Int, @@ -193,7 +196,8 @@ class MedicalRecordAddFragment : Fragment(), } private fun initHospitalName() { - binding.edittextMedicalrecordaddHospitalName.addTextChangedListener(object : TextWatcher { + binding.edittextMedicalrecordaddHospitalName.addTextChangedListener( + object : TextWatcher { override fun beforeTextChanged( s: CharSequence?, start: Int, diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt index 7f7f9902..b21abb5c 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt @@ -36,12 +36,14 @@ class MedicalRecordInfoFragment : Fragment() { return binding.root } - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + override fun onViewCreated( + view: View, + savedInstanceState: Bundle?, + ) { super.onViewCreated(view, savedInstanceState) //Todo: 전달받은 진료기록 아이디 연결, 액세스 토큰 userViewModel로 연결 medicalRecordId = 1 - accessToken = - "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjM0MzYxOX0.qXPMWcqU8ZoLVwJEyxYd3WJFR8GgN0Tsr1fEg5jJgnA" + accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjM0MzYxOX0.qXPMWcqU8ZoLVwJEyxYd3WJFR8GgN0Tsr1fEg5jJgnA" setMedicalRecord() getMedicalRecord() @@ -64,7 +66,7 @@ class MedicalRecordInfoFragment : Fragment() { buttonDeleteDialogDelete.setOnClickListener { medicalRecordViewModel.deleteMedicalRecordList( intArrayOf(medicalRecordId.toInt()), - accessToken + accessToken, ) isDeleteSuccess() } From 3775a4f4bb2560835f7a38a7d34c137aa8bd8592 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 05:34:35 +0900 Subject: [PATCH 32/33] =?UTF-8?q?refactor:=20=EC=BD=94=ED=8B=80=EB=A6=B0?= =?UTF-8?q?=20=EC=BB=A8=EB=B2=A4=EC=85=98=EC=97=90=20=EB=A7=9E=EC=B6=B0=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/MedicalRecordAddFragment.kt | 117 +++++++++--------- .../view/MedicalRecordInfoFragment.kt | 4 +- 2 files changed, 62 insertions(+), 59 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 2552d75a..e35acad3 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 @@ -144,82 +144,85 @@ class MedicalRecordAddFragment : private fun initNote() { binding.edittextMedicalrecordaddNoteDetail.addTextChangedListener( object : TextWatcher { - override fun beforeTextChanged( - s: CharSequence?, - start: Int, - count: Int, - after: Int, - ) { - } + override fun beforeTextChanged( + s: CharSequence?, + start: Int, + count: Int, + after: Int, + ) { + } - override fun onTextChanged( - s: CharSequence?, - start: Int, - before: Int, - count: Int, - ) { - val textLength = s?.length ?: 0 - binding.textviewMedicalrecordaddNoteCount.text = - getString(R.string.medicalrecord_note_length, textLength) - } + override fun onTextChanged( + s: CharSequence?, + start: Int, + before: Int, + count: Int, + ) { + val textLength = s?.length ?: 0 + binding.textviewMedicalrecordaddNoteCount.text = + getString(R.string.medicalrecord_note_length, textLength) + } - override fun afterTextChanged(s: Editable?) { + override fun afterTextChanged(s: Editable?) { + } } - }) + ) } private fun initVeterinarianName() { binding.edittextMedicalrecordaddVeterinarianName.addTextChangedListener( object : TextWatcher { - override fun beforeTextChanged( - s: CharSequence?, - start: Int, - count: Int, - after: Int, - ) { - } + override fun beforeTextChanged( + s: CharSequence?, + start: Int, + count: Int, + after: Int, + ) { + } - override fun onTextChanged( - s: CharSequence?, - start: Int, - before: Int, - count: Int, - ) { - val textLength = s?.length ?: 0 - binding.textviewMedicalrecordaddVeterinarianNameCount.text = - getString(R.string.medicalrecord_veterinarian_name_length, textLength) - } + override fun onTextChanged( + s: CharSequence?, + start: Int, + before: Int, + count: Int, + ) { + val textLength = s?.length ?: 0 + binding.textviewMedicalrecordaddVeterinarianNameCount.text = + getString(R.string.medicalrecord_veterinarian_name_length, textLength) + } - override fun afterTextChanged(s: Editable?) { + override fun afterTextChanged(s: Editable?) { + } } - }) + ) } private fun initHospitalName() { binding.edittextMedicalrecordaddHospitalName.addTextChangedListener( object : TextWatcher { - override fun beforeTextChanged( - s: CharSequence?, - start: Int, - count: Int, - after: Int, - ) { - } + override fun beforeTextChanged( + s: CharSequence?, + start: Int, + count: Int, + after: Int, + ) { + } - override fun onTextChanged( - s: CharSequence?, - start: Int, - before: Int, - count: Int, - ) { - val textLength = s?.length ?: 0 - binding.textviewMedicalrecordaddHospitalNameCount.text = - getString(R.string.medicalrecord_hospital_name_length, textLength) - } + override fun onTextChanged( + s: CharSequence?, + start: Int, + before: Int, + count: Int, + ) { + val textLength = s?.length ?: 0 + binding.textviewMedicalrecordaddHospitalNameCount.text = + getString(R.string.medicalrecord_hospital_name_length, textLength) + } - override fun afterTextChanged(s: Editable?) { + override fun afterTextChanged(s: Editable?) { + } } - }) + ) } private fun initDateBtn() { diff --git a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt index b21abb5c..e6149217 100644 --- a/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt +++ b/app/src/main/java/com/project/meongcare/medicalrecord/view/MedicalRecordInfoFragment.kt @@ -41,10 +41,10 @@ class MedicalRecordInfoFragment : Fragment() { savedInstanceState: Bundle?, ) { super.onViewCreated(view, savedInstanceState) - //Todo: 전달받은 진료기록 아이디 연결, 액세스 토큰 userViewModel로 연결 + // Todo: 전달받은 진료기록 아이디 연결, 액세스 토큰 userViewModel로 연결 medicalRecordId = 1 accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MTgsImV4cCI6MTcxMjM0MzYxOX0.qXPMWcqU8ZoLVwJEyxYd3WJFR8GgN0Tsr1fEg5jJgnA" - + setMedicalRecord() getMedicalRecord() initBackBtn() From 3e01f1cbb0b37427899611ae83ddd048d9312035 Mon Sep 17 00:00:00 2001 From: iiolo Date: Sat, 6 Apr 2024 05:36:28 +0900 Subject: [PATCH 33/33] =?UTF-8?q?chore:=20=EC=95=B1=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20=EC=8B=9C=20=EC=95=B1=20=EB=82=B4=EB=B6=80=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=82=AD=EC=A0=9C=ED=95=B4=EC=A3=BC?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../medicalrecord/view/MedicalRecordAddFragment.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 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 e35acad3..b3259ef7 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 @@ -165,7 +165,7 @@ class MedicalRecordAddFragment : override fun afterTextChanged(s: Editable?) { } - } + }, ) } @@ -193,7 +193,7 @@ class MedicalRecordAddFragment : override fun afterTextChanged(s: Editable?) { } - } + }, ) } @@ -221,7 +221,7 @@ class MedicalRecordAddFragment : override fun afterTextChanged(s: Editable?) { } - } + }, ) }