fix(character-detail): 캐릭터 정보 추가

- mbti, 나이, 성별 추가
This commit is contained in:
2025-09-05 17:43:04 +09:00
parent e39bdb6b03
commit cc3aca34f5
7 changed files with 122 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import android.graphics.Rect
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.net.toUri
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@@ -115,6 +116,55 @@ class CharacterDetailFragment : BaseFragment<FragmentCharacterDetailBinding>(
binding.ivCharacterBackground.load(detail.imageUrl) { crossfade(true) }
// 기본 정보
if (detail.gender != null) {
binding.tvGender.visibility = View.VISIBLE
binding.tvGender.text = detail.gender
if (detail.gender == "남성") {
binding.tvGender.setTextColor(
ContextCompat.getColor(
requireContext(),
R.color.color_3bb9f1
)
)
binding.tvGender.setBackgroundResource(R.drawable.bg_character_gender_male)
} else {
binding.tvGender.setTextColor(
ContextCompat.getColor(
requireContext(),
R.color.color_ff5c49
)
)
binding.tvGender.setBackgroundResource(R.drawable.bg_character_gender_female)
}
} else {
binding.tvGender.visibility = View.GONE
}
if (detail.age != null) {
binding.tvAge.visibility = View.VISIBLE
binding.tvAge.text = "${detail.age}"
} else {
binding.tvAge.visibility = View.GONE
}
if (detail.mbti != null) {
binding.tvMbti.visibility = View.VISIBLE
binding.tvMbti.text = detail.mbti
} else {
binding.tvMbti.visibility = View.GONE
}
binding.llGenderAgeMbti.visibility = if (
detail.mbti == null &&
detail.age == null &&
detail.gender == null
) {
View.GONE
} else {
View.VISIBLE
}
binding.tvCharacterName.text = detail.name
binding.tvCharacterStatus.text = when (detail.characterType) {
CharacterType.CLONE -> "Clone"

View File

@@ -10,6 +10,8 @@ data class CharacterDetailResponse(
@SerializedName("name") val name: String,
@SerializedName("description") val description: String,
@SerializedName("mbti") val mbti: String?,
@SerializedName("gender") val gender: String?,
@SerializedName("age") val age: Int?,
@SerializedName("imageUrl") val imageUrl: String,
@SerializedName("personalities") val personalities: CharacterPersonalityResponse?,
@SerializedName("backgrounds") val backgrounds: CharacterBackgroundResponse?,