Skip to content

Commit

Permalink
Merge pull request #48 from Keyneez/feature/#36-detail-server-connect
Browse files Browse the repository at this point in the history
[Feat/#36] detail ์„œ๋ฒ„ ์—ฐ๊ฒฐ
  • Loading branch information
etama123 authored Jan 12, 2023
2 parents 02b5b90 + 6ea66ad commit 2d2d1ce
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
package com.keyneez.data.model.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@kotlinx.serialization.Serializable
@Serializable
data class ResponseGetContentDeatilDto(
@SerialName("content_key")
val key: Int,
val key: Int?,
@SerialName("content_title")
val title: String,
val title: String?,
@SerialName("content_link")
val link: String,
val link: String?,
@SerialName("content_img")
val img: String,
val img: String?,
@SerialName("place")
val place: String,
@SerialName("introdution")
val introdution: String,
val place: String?,
@SerialName("introduction")
val introduction: String?,
@SerialName("benefit")
val benefit: String,
val benefit: String?,
@SerialName("usage")
val usage: String,
val usage: String?,
@SerialName("start_at")
val start: String,
val start: String?,
@SerialName("end_at")
val end: String,
val end: String?,
@SerialName("liked")
val liked: Boolean,
@SerialName("category")
val category: Category
val category: List<String>
) {
@kotlinx.serialization.Serializable
@Serializable
data class Category(
val category: String?
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class DetailActivity :
}

private fun initBackClickListener() {
binding.btnDetailBack.setOnSingleClickListener { }
binding.btnDetailBack.setOnSingleClickListener {
finish()
}
}

private fun initShareClickListener() {
Expand Down
39 changes: 38 additions & 1 deletion app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ object BindingAdapter {
this.load(url)
}

@JvmStatic
@BindingAdapter("setImage")
fun ImageView.setImage(url: String?) {
this.load(url)
}

@JvmStatic
@BindingAdapter("isSelected")
fun View.isSelected(selected: Boolean) {
Expand All @@ -44,7 +50,7 @@ object BindingAdapter {

@JvmStatic
@BindingAdapter("putStartDate", "putEndDate")
fun TextView.setDuration(start: String, end: String) {
fun TextView.setDuration(start: String?, end: String?) {
if (start == null || end == null) {
this.text = "2023"
return
Expand Down Expand Up @@ -93,4 +99,35 @@ object BindingAdapter {
this.layoutParams = it
}
}

@JvmStatic
@BindingAdapter("keywordColor")
fun TextView.setKeywordColor(txt: String?) {
txt?.let {
when (txt) {
"๋ฌธํ™”" -> {
this.setTextColor(this.context.getColor(R.color.mint500))
this.background = this.context.getDrawable(R.drawable.shape_mint500_line_rect)
}
"์ง„๋กœ" -> {
this.setTextColor(this.context.getColor(R.color.green600))
this.background = this.context.getDrawable(R.drawable.shape_green600_line_rect)
}
"๋ด‰์‚ฌ" -> {
this.setTextColor(this.context.getColor(R.color.purple500))
this.background = this.context.getDrawable(R.drawable.shape_purple500_line_rect)
}

"์—ฌํ–‰" -> {
this.setTextColor(this.context.getColor(R.color.pink500))
this.background = this.context.getDrawable(R.drawable.shape_pink500_line_rect)
}

"์ง„๋กœ" -> {
this.setTextColor(this.context.getColor(R.color.red500))
this.background = this.context.getDrawable(R.drawable.shape_red500_line_rect)
}
}
}
}
}
11 changes: 6 additions & 5 deletions app/src/main/res/layout/activity_home_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@
android:layout_height="wrap_content"
android:layout_marginStart="31dp"
android:layout_marginTop="8dp"
android:text="@{vm.detailContent.category.category}"
android:text="@{vm.detailContent.category.get(0)}"
keywordColor="@{vm.detailContent.category.get(0)}"
style="@style/PretendardBold14"
android:textColor="@color/mint500"
android:background="@drawable/shape_mint500_line_rect"
android:paddingHorizontal="12dp"
android:paddingVertical="8dp"
app:layout_constraintStart_toStartOf="parent"
Expand Down Expand Up @@ -125,6 +124,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
putStartDate="@{vm.detailContent.start}"
putEndDate="@{vm.detailContent.end}"
android:text="@{@string/detail_period(vm.detailContent.start,vm.detailContent.end)}"
android:textColor="@color/gray900"
app:layout_constraintStart_toEndOf="@id/tv_detail_period_title"
Expand All @@ -136,7 +137,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:scaleType="centerCrop"
android:src="@{vm.detailContent.img}"
setImage="@{vm.detailContent.img}"
app:layout_constraintTop_toBottomOf="@id/tv_detail_period_title" />

<TextView
Expand Down Expand Up @@ -164,7 +165,7 @@
android:layout_marginTop="16dp"
android:textColor="@color/gray900"
app:layout_constraintTop_toBottomOf="@id/btn_detail_link"
android:text="@{vm.detailContent.introdution}" />
android:text="@{vm.detailContent.introduction}" />

<TextView
android:id="@+id/tv_detail_benefit_title"
Expand Down

0 comments on commit 2d2d1ce

Please sign in to comment.