fix(character-detail): 캐릭터 정보 추가
- mbti, 나이, 성별 추가
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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?,
|
||||
|
||||
Reference in New Issue
Block a user