From 827158bbc61736ec9c3a92d55b94b46cad4e6ee9 Mon Sep 17 00:00:00 2001 From: tama Date: Fri, 13 Jan 2023 02:17:00 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[FIX/#36]=20ResponseContentDetailDto=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response/ResponseGetContentDeatilDto.kt | 29 +++++++++-------- .../keyneez/util/binding/BindingAdapter.kt | 32 +++++++++++++++++++ .../main/res/layout/activity_home_detail.xml | 7 ++-- 3 files changed, 50 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/keyneez/data/model/response/ResponseGetContentDeatilDto.kt b/app/src/main/java/com/keyneez/data/model/response/ResponseGetContentDeatilDto.kt index 81a520b..4898c9c 100644 --- a/app/src/main/java/com/keyneez/data/model/response/ResponseGetContentDeatilDto.kt +++ b/app/src/main/java/com/keyneez/data/model/response/ResponseGetContentDeatilDto.kt @@ -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 ) { - @kotlinx.serialization.Serializable + @Serializable data class Category( val category: String? ) diff --git a/app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt b/app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt index 61bccaf..9cc8360 100644 --- a/app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt +++ b/app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt @@ -5,6 +5,7 @@ import android.view.ViewGroup import android.widget.TextView import androidx.databinding.BindingAdapter import androidx.lifecycle.LiveData +import com.lab.keyneez.R object BindingAdapter { @JvmStatic @@ -36,4 +37,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) + } + } + } + } } diff --git a/app/src/main/res/layout/activity_home_detail.xml b/app/src/main/res/layout/activity_home_detail.xml index 7917538..01f2412 100644 --- a/app/src/main/res/layout/activity_home_detail.xml +++ b/app/src/main/res/layout/activity_home_detail.xml @@ -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" @@ -164,7 +163,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}" /> Date: Fri, 13 Jan 2023 04:29:33 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[FEAT/#36]=20=EC=82=AC=EC=A7=84=20=EB=B0=94?= =?UTF-8?q?=EC=9D=B8=EB=94=A9=20=EC=96=B4=EB=8C=91=ED=84=B0=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/keyneez/util/binding/BindingAdapter.kt | 8 +++++++- app/src/main/res/layout/activity_home_detail.xml | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt b/app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt index f562020..d2dbef4 100644 --- a/app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt +++ b/app/src/main/java/com/keyneez/util/binding/BindingAdapter.kt @@ -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) { @@ -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 diff --git a/app/src/main/res/layout/activity_home_detail.xml b/app/src/main/res/layout/activity_home_detail.xml index 01f2412..28b115b 100644 --- a/app/src/main/res/layout/activity_home_detail.xml +++ b/app/src/main/res/layout/activity_home_detail.xml @@ -124,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" @@ -135,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" /> Date: Fri, 13 Jan 2023 04:40:43 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[FEAT/#36]=20detail=20/=20=EB=92=A4?= =?UTF-8?q?=EB=A1=9C=EA=B0=80=EA=B8=B0=20=ED=81=B4=EB=A6=AD=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/keyneez/presentation/main/detail/DetailActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keyneez/presentation/main/detail/DetailActivity.kt b/app/src/main/java/com/keyneez/presentation/main/detail/DetailActivity.kt index 4c3a634..abe9670 100644 --- a/app/src/main/java/com/keyneez/presentation/main/detail/DetailActivity.kt +++ b/app/src/main/java/com/keyneez/presentation/main/detail/DetailActivity.kt @@ -28,7 +28,9 @@ class DetailActivity : } private fun initBackClickListener() { - binding.btnDetailBack.setOnSingleClickListener { } + binding.btnDetailBack.setOnSingleClickListener { + finish() + } } private fun initShareClickListener() {