Skip to content

Commit

Permalink
#187 의약품 상세 정보 응답 시 재심사 날짜로 인해 발생하는 데이터 오류 수정, UI에 표시할 데이터 구조 수정하였고 M…
Browse files Browse the repository at this point in the history
…apper클래스를 만들어서 적절한 값으로 변경하여 주는 기능 추가 및 지속 작업 중
  • Loading branch information
pknujsp committed Aug 1, 2023
1 parent 9ba3020 commit b97adbd
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import androidx.core.view.isVisible
import androidx.core.widget.TextViewCompat
import androidx.databinding.BindingAdapter
import com.android.mediproject.core.common.R
import com.android.mediproject.core.model.medicine.common.producttype.MedicationProductType
import com.android.mediproject.core.model.medicine.common.producttype.FilterMedicationProductType
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.module.AppGlideModule

Expand All @@ -21,7 +21,7 @@ class GlideAppModule : AppGlideModule()
object BindingAdapter {
@JvmStatic
@BindingAdapter("medicationTypeText")
fun setMedicationTypeText(textView: TextView, type: MedicationProductType) {
fun setMedicationTypeText(textView: TextView, type: FilterMedicationProductType) {
val arr = textView.context.resources.getStringArray(R.array.medicationTypes)
textView.text = arr[type.ordinal]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ enum class FilterMedicationProductType(val text: String, @StringRes val stringRe
);

companion object {

fun FilterMedicationProductType.text() = text
fun FilterMedicationProductType.stringResId() = stringResId

fun enumOf(text: String) = values().find { text.contains(it.text) }!!
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ enum class MedicationProductType(val description: String, @StringRes val stringR
GENERAL("일반", R.string.medicineProductType_general);

companion object {
fun valueOf(description: String) = values().find { description.contains(it.name) } ?: throw IllegalArgumentException()
fun enumOf(description: String) = values().find { description.contains(it.name) } ?: throw IllegalArgumentException()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.android.mediproject.core.model.medicine.medicinedetailinfo
import com.android.mediproject.core.model.DateTimeValue
import com.android.mediproject.core.model.medicine.common.cancel.MedicineCancelStatus
import com.android.mediproject.core.model.medicine.common.cancel.MedicineCancelStatusMapper
import com.android.mediproject.core.model.medicine.common.producttype.MedicationProductType
import com.android.mediproject.core.model.medicine.common.producttype.FilterMedicationProductType
import com.android.mediproject.core.model.toLocalDate
import com.android.mediproject.core.model.util.XMLParsedResult
import com.android.mediproject.core.model.util.parseXmlString
Expand Down Expand Up @@ -66,7 +66,7 @@ data class MedicineDetail(
val entpEnglishName: String,
val entpName: String,
val entpNumber: String,
val medicationProductType: MedicationProductType,
val medicationProductType: FilterMedicationProductType,
val gbnName: String,
val industryType: String,
val ingredientName: String,
Expand Down Expand Up @@ -107,7 +107,7 @@ fun MedicineDetailInfoResponse.Item.toMedicineDetail(medicineIdInServer: Long =
entpEnglishName = entpEnglishName,
entpName = entpName,
entpNumber = entpNumber,
medicationProductType = MedicationProductType.valueOf(etcOtcCode),
medicationProductType = FilterMedicationProductType.enumOf(etcOtcCode),
gbnName = gbnName,
industryType = industryType,
ingredientName = ingredientName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ fun ListItem(recallSuspension: RecallSuspension) {
)
Text(
text = recallSuspension.run {
if (recallCommandDate != null) recallCommandDate
if (recallCommandDate.isEmpty) recallCommandDate
else destructionOrderDate
}!!.format(dateFormat),
}.value.format(dateFormat),
fontSize = 12.sp,
modifier = Modifier.align(CenterVertically),
color = Color.Gray,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import com.android.mediproject.core.common.viewmodel.UiState
import com.android.mediproject.core.common.viewmodel.asEventFlow
import com.android.mediproject.core.domain.GetMedicineDetailsUseCase
import com.android.mediproject.core.model.ai.ClassificationResult
import com.android.mediproject.core.model.navargs.MedicineInfoArgs
import com.android.mediproject.core.model.medicine.medicinedetailinfo.MedicineDetail
import com.android.mediproject.core.model.navargs.MedicineInfoArgs
import com.android.mediproject.core.ui.base.BaseViewModel
import com.android.mediproject.feature.search.result.EventState
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down Expand Up @@ -80,7 +80,7 @@ class AiSearchResultViewModel @Inject constructor(
itemEngName = e.itemEnglishName,
itemSeq = e.itemSequence.toLong(),
productType = e.industryType,
medicineType = e.medicationProductType,
medicineType = e.medicationProductType.text,
imgUrl = e.insertFileUrl,
),
),
Expand Down
2 changes: 1 addition & 1 deletion feature/search/src/main/res/layout/ai_medicine_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
android:layout_height="wrap_content"
android:background="@drawable/medicine_type_background"
android:maxLines="1"
android:text="@{item.medicineDetail.medicationProductType}"
android:text="@{item.medicineDetail.medicationProductType.stringResId}"
android:textColor="@color/medicineType"
android:textSize="11sp"
app:layout_constraintLeft_toRightOf="@id/medicineNameTextView"
Expand Down

0 comments on commit b97adbd

Please sign in to comment.