From 556d13f0cb0ee92b3fcbae8355d9bcaf2fbe42c6 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 5 Jan 2024 10:13:41 +0900 Subject: [PATCH 1/8] =?UTF-8?q?[feat]=20#29=20ViewExt=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20(stringOf,=20colorOf,=20drawableOf)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/sopt/pingle/util/view/ViewExt.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/org/sopt/pingle/util/view/ViewExt.kt b/app/src/main/java/org/sopt/pingle/util/view/ViewExt.kt index dd73459c..3a70b93b 100644 --- a/app/src/main/java/org/sopt/pingle/util/view/ViewExt.kt +++ b/app/src/main/java/org/sopt/pingle/util/view/ViewExt.kt @@ -1,6 +1,11 @@ package org.sopt.pingle.util.view import android.view.View +import androidx.annotation.ColorRes +import androidx.annotation.DrawableRes +import androidx.annotation.StringRes +import androidx.core.content.ContextCompat +import androidx.core.content.ContextCompat.getString import androidx.recyclerview.widget.DiffUtil import com.google.android.material.snackbar.Snackbar @@ -25,6 +30,12 @@ fun View.showSnackBar(message: String, isShort: Boolean = true) { Snackbar.make(this, message, duration).show() } +fun View.stringOf(@StringRes resId: Int) = getString(context, resId) + +fun View.colorOf(@ColorRes resId: Int) = ContextCompat.getColor(context, resId) + +fun View.drawableOf(@DrawableRes resId: Int) = ContextCompat.getDrawable(context, resId) + class ItemDiffCallback( val onItemsTheSame: (T, T) -> Boolean, val onContentsTheSame: (T, T) -> Boolean From 3b9baa32635638d2c5491ebf9749d2207f2dec95 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 5 Jan 2024 10:14:05 +0900 Subject: [PATCH 2/8] =?UTF-8?q?[chore]=20#29=20badge,=20chip=EC=97=90=20?= =?UTF-8?q?=ED=99=95=EC=9E=A5=ED=95=A8=EC=88=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/pingle/util/component/PingleBadge.kt | 8 +++++--- .../java/org/sopt/pingle/util/component/PingleChip.kt | 9 +++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/sopt/pingle/util/component/PingleBadge.kt b/app/src/main/java/org/sopt/pingle/util/component/PingleBadge.kt index 11742f6e..ccc55577 100644 --- a/app/src/main/java/org/sopt/pingle/util/component/PingleBadge.kt +++ b/app/src/main/java/org/sopt/pingle/util/component/PingleBadge.kt @@ -8,6 +8,8 @@ import android.view.LayoutInflater import androidx.constraintlayout.widget.ConstraintLayout import org.sopt.pingle.databinding.BadgePingleBinding import org.sopt.pingle.presentation.type.CategoryType +import org.sopt.pingle.util.view.colorOf +import org.sopt.pingle.util.view.stringOf @SuppressLint("CustomViewStyleable") class PingleBadge @JvmOverloads constructor( @@ -23,10 +25,10 @@ class PingleBadge @JvmOverloads constructor( fun setBadgeCategoryType(categoryType: CategoryType) { with(binding.tvBadgePingleText) { - text = context.getText(categoryType.categoryNameRes) - setTextColor(context.getColor(categoryType.textColor)) + text = stringOf(categoryType.categoryNameRes) + setTextColor(colorOf(categoryType.textColor)) backgroundTintList = - ColorStateList.valueOf(context.getColor(categoryType.backgroundBadgeColor)) + ColorStateList.valueOf(colorOf(categoryType.backgroundBadgeColor)) } } } diff --git a/app/src/main/java/org/sopt/pingle/util/component/PingleChip.kt b/app/src/main/java/org/sopt/pingle/util/component/PingleChip.kt index 7bdff03f..773c1893 100644 --- a/app/src/main/java/org/sopt/pingle/util/component/PingleChip.kt +++ b/app/src/main/java/org/sopt/pingle/util/component/PingleChip.kt @@ -4,10 +4,11 @@ import android.annotation.SuppressLint import android.content.Context import android.content.res.ColorStateList import android.util.AttributeSet -import androidx.core.content.ContextCompat import com.google.android.material.chip.Chip import org.sopt.pingle.R import org.sopt.pingle.presentation.type.CategoryType +import org.sopt.pingle.util.view.colorOf +import org.sopt.pingle.util.view.stringOf @SuppressLint("CustomViewStyleable") class PingleChip @JvmOverloads constructor( @@ -27,8 +28,8 @@ class PingleChip @JvmOverloads constructor( intArrayOf(-android.R.attr.state_checked) ), intArrayOf( - ContextCompat.getColor(context, activatedColorRes), - ContextCompat.getColor(context, inactivatedColorRes) + colorOf(activatedColorRes), + colorOf(inactivatedColorRes) ) ) @@ -37,7 +38,7 @@ class PingleChip @JvmOverloads constructor( val inactivatedTextColor = R.color.g_03 val inactivatedChipColor = R.color.g_11 - text = context.getText(categoryType.categoryNameRes) + text = stringOf(categoryType.categoryNameRes) chipStrokeColor = setColorStateList( context = context, activatedColorRes = categoryType.activatedOutLinedColor, From 256b29b4c665eca220afade2745e6d34c0e40c31 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 5 Jan 2024 10:14:47 +0900 Subject: [PATCH 3/8] =?UTF-8?q?[add]=20#29=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=A7=80=EB=8F=84=20=EB=B7=B0=20=EC=B0=B8=EC=97=AC=EB=AA=A8?= =?UTF-8?q?=EB=8B=AC=20=EA=B5=AC=ED=98=84=EC=9D=84=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?string=20=EB=A6=AC=EC=86=8C=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values/strings.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8b12354f..1a8770d2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,8 +14,14 @@ 마이핑글 설정 - + 핑글에 오신걸\n환영합니다! 기존 단체\n입장하기 신규 단체\n개설하기 + + + 참여하기 + + + 이 핑글에 참여할까요? \ No newline at end of file From d87ad59db05fc442c722dc04261a56d950f30579 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 5 Jan 2024 10:15:00 +0900 Subject: [PATCH 4/8] =?UTF-8?q?[add]=20#29=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=A7=80=EB=8F=84=20=EB=B7=B0=20=EC=B0=B8=EC=97=AC=EB=AA=A8?= =?UTF-8?q?=EB=8B=AC=20=EA=B5=AC=ED=98=84=EC=9D=84=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?dimen=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values/dimens.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index d4cbef71..91ec1bbd 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -33,4 +33,7 @@ 56dp 42dp 42dp + + 24dp + 24dp \ No newline at end of file From 11fbaaf11b879c646cbad5eaef4135d677319baf Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 5 Jan 2024 10:19:03 +0900 Subject: [PATCH 5/8] =?UTF-8?q?[feat]=20#29=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=A7=80=EB=8F=84=20=EB=B7=B0=20=EB=8B=A4=EC=9D=B4=EC=96=BC?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/home/map/MapModalDialogFragment.kt | 40 ++++++ app/src/main/res/layout/dialog_map_modal.xml | 135 ++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 app/src/main/java/org/sopt/pingle/presentation/ui/main/home/map/MapModalDialogFragment.kt create mode 100644 app/src/main/res/layout/dialog_map_modal.xml diff --git a/app/src/main/java/org/sopt/pingle/presentation/ui/main/home/map/MapModalDialogFragment.kt b/app/src/main/java/org/sopt/pingle/presentation/ui/main/home/map/MapModalDialogFragment.kt new file mode 100644 index 00000000..b2a628a2 --- /dev/null +++ b/app/src/main/java/org/sopt/pingle/presentation/ui/main/home/map/MapModalDialogFragment.kt @@ -0,0 +1,40 @@ +package org.sopt.pingle.presentation.ui.main.home.map + +import android.os.Bundle +import android.view.View +import org.sopt.pingle.R +import org.sopt.pingle.databinding.DialogMapModalBinding +import org.sopt.pingle.presentation.type.CategoryType +import org.sopt.pingle.util.base.BindingDialogFragment +import org.sopt.pingle.util.fragment.colorOf + +class MapModalDialogFragment( + private val category: CategoryType, + private val name: String, + private val ownerName: String, + private val clickBtn: () -> Unit +) : BindingDialogFragment(R.layout.dialog_map_modal) { + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + initLayout() + addListeners() + } + + private fun initLayout() { + with(binding) { + badgeMapModalPingleInfoCategory.setBadgeCategoryType(category) + tvMapModalPingleInfoName.text = name + tvMapModalPingleInfoName.setTextColor(colorOf(category.textColor)) + tvMapModalPingleInfoOwnerName.text = ownerName + } + } + + private fun addListeners() { + binding.btnMapModal.setOnClickListener { + clickBtn() + dismiss() + } + } +} diff --git a/app/src/main/res/layout/dialog_map_modal.xml b/app/src/main/res/layout/dialog_map_modal.xml new file mode 100644 index 00000000..125e4b6e --- /dev/null +++ b/app/src/main/res/layout/dialog_map_modal.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 23970adf5643ba05c7de3fae095650b9d816cdd0 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 5 Jan 2024 10:19:30 +0900 Subject: [PATCH 6/8] =?UTF-8?q?[chore]=20#29=20BindingDialogFragment=20bac?= =?UTF-8?q?kground=20=EC=83=89=EC=83=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/pingle/util/base/BindingDialogFragment.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/sopt/pingle/util/base/BindingDialogFragment.kt b/app/src/main/java/org/sopt/pingle/util/base/BindingDialogFragment.kt index 4c0a235a..9f974049 100644 --- a/app/src/main/java/org/sopt/pingle/util/base/BindingDialogFragment.kt +++ b/app/src/main/java/org/sopt/pingle/util/base/BindingDialogFragment.kt @@ -9,6 +9,7 @@ import androidx.annotation.LayoutRes import androidx.databinding.DataBindingUtil import androidx.databinding.ViewDataBinding import androidx.fragment.app.DialogFragment +import org.sopt.pingle.R abstract class BindingDialogFragment(@LayoutRes private val layoutResId: Int) : DialogFragment() { @@ -31,7 +32,7 @@ abstract class BindingDialogFragment(@LayoutRes private val WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT ) - dialog?.window?.setBackgroundDrawableResource(android.R.color.transparent) + dialog?.window?.setBackgroundDrawableResource(R.color.backdrop) dialog?.setCancelable(false) dialog?.setCanceledOnTouchOutside(true) } From 17a1759a82b3b1f96920296746cf1726b5e11001 Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 5 Jan 2024 17:49:40 +0900 Subject: [PATCH 7/8] =?UTF-8?q?[chore]=20#29=20=EB=84=A4=EC=9D=B4=EB=B0=8D?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20(map=20->=20map=5Fmodal)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/dialog_map_modal.xml | 4 ++-- app/src/main/res/values/dimens.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/layout/dialog_map_modal.xml b/app/src/main/res/layout/dialog_map_modal.xml index 125e4b6e..1a0aa2b2 100644 --- a/app/src/main/res/layout/dialog_map_modal.xml +++ b/app/src/main/res/layout/dialog_map_modal.xml @@ -27,14 +27,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" - app:layout_constraintGuide_begin="@dimen/dialog_map_horizontal_margin" /> + app:layout_constraintGuide_begin="@dimen/dialog_map_modal_horizontal_margin" /> + app:layout_constraintGuide_end="@dimen/dialog_map_modal_horizontal_margin" /> 42dp 24dp - 24dp + 24dp \ No newline at end of file From 0f4c75d3d21e3841aa1ff68ce65915d9d9a61e8e Mon Sep 17 00:00:00 2001 From: jihyunniiii Date: Fri, 5 Jan 2024 20:30:01 +0900 Subject: [PATCH 8/8] [chore] #29 @+id -> @id --- app/src/main/res/layout/dialog_map_modal.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/dialog_map_modal.xml b/app/src/main/res/layout/dialog_map_modal.xml index 1a0aa2b2..83dba59b 100644 --- a/app/src/main/res/layout/dialog_map_modal.xml +++ b/app/src/main/res/layout/dialog_map_modal.xml @@ -124,8 +124,8 @@ android:text="@string/map_participate" android:textColor="@color/g_10" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/gl_end" - app:layout_constraintStart_toStartOf="@+id/gl_start" + app:layout_constraintEnd_toStartOf="@id/gl_end" + app:layout_constraintStart_toStartOf="@id/gl_start" app:layout_constraintTop_toBottomOf="@id/tv_map_modal_description" />