Skip to content

Commit

Permalink
fix : MyInfo 알레르기 칩 "없음" 선택지 노출 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-comlinee committed Nov 28, 2024
1 parent 24df00b commit 0b26fb9
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions app/src/main/java/com/dna/beyoureyes/ui/myInfo/MyInfoFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,30 @@ class MyInfoFragment : Fragment() {


AppUser.info?.allergic?.forEach {
val chip = Chip(requireContext())
chip.text = allergyMap[it]
if (chip.text.length == 1) {
chip.text = " " + allergyMap[it] + " " // 한글자인 경우에는 width 설정이 안됐음ㅜㅜ...
}
val params = LinearLayout.LayoutParams(
resources.getDimensionPixelSize(R.dimen.chip_width), // 85dp
resources.getDimensionPixelSize(R.dimen.chip_height) // 40dp
)
params.gravity = Gravity.CENTER
chip.layoutParams = params

chip.setTextAppearanceResource(R.style.chipTextMyInfo)
chip.isChecked = true // 클릭된 상태로 설정
chip.isClickable = false // 클릭 불가능
//chip.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.blue_50))
chip.setChipBackgroundColorResource(R.color.blue_50)
chip.setChipStrokeColorResource(R.color.blue_300)
binding.allergyChipGroup.addView(chip)

chip.post {
Log.d("ChipWidth", "Chip ${chip.text} width: ${chip.width} px")
if (it != "none") {
val chip = Chip(requireContext())
chip.text = allergyMap[it]
if (chip.text.length == 1) {
chip.text = " " + allergyMap[it] + " " // 한글자인 경우에는 width 설정이 안됐음ㅜㅜ...
}
val params = LinearLayout.LayoutParams(
resources.getDimensionPixelSize(R.dimen.chip_width), // 85dp
resources.getDimensionPixelSize(R.dimen.chip_height) // 40dp
)
params.gravity = Gravity.CENTER
chip.layoutParams = params

chip.setTextAppearanceResource(R.style.chipTextMyInfo)
chip.isChecked = true // 클릭된 상태로 설정
chip.isClickable = false // 클릭 불가능
//chip.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.blue_50))
chip.setChipBackgroundColorResource(R.color.blue_50)
chip.setChipStrokeColorResource(R.color.blue_300)
binding.allergyChipGroup.addView(chip)

chip.post {
Log.d("ChipWidth", "Chip ${chip.text} width: ${chip.width} px")
}
}
}
}
Expand Down

0 comments on commit 0b26fb9

Please sign in to comment.