diff --git a/app/src/main/java/org/sopt/pingle/presentation/type/CategoryType.kt b/app/src/main/java/org/sopt/pingle/presentation/type/CategoryType.kt index d9f38b0b..4ad2c848 100644 --- a/app/src/main/java/org/sopt/pingle/presentation/type/CategoryType.kt +++ b/app/src/main/java/org/sopt/pingle/presentation/type/CategoryType.kt @@ -9,9 +9,9 @@ enum class CategoryType( @ColorRes val activatedOutLinedColor: Int, @ColorRes val backgroundChipColor: Int, @ColorRes val backgroundBadgeColor: Int, - @StringRes val categoryNameRes: Int + @StringRes val categoryNameRes: Int, + @StringRes val categoryDescriptionRes: Int // TODO 해당 부분은 UX, icon 정해지면 추가하기 - // @StringRes val categoryDescriptionRes: Int, // @DrawableRes val categoryIconRes: Int, ) { PLAY( @@ -19,28 +19,32 @@ enum class CategoryType( activatedOutLinedColor = R.color.pingle_green, backgroundChipColor = R.color.chip_green, backgroundBadgeColor = R.color.badge_green, - categoryNameRes = R.string.category_play + categoryNameRes = R.string.category_play, + categoryDescriptionRes = R.string.category_play_detail ), STUDY( textColor = R.color.pingle_orange, activatedOutLinedColor = R.color.pingle_orange, backgroundChipColor = R.color.chip_orange, backgroundBadgeColor = R.color.badge_orange, - categoryNameRes = R.string.category_study + categoryNameRes = R.string.category_study, + categoryDescriptionRes = R.string.category_study_detail ), MULTI( textColor = R.color.pingle_yellow, activatedOutLinedColor = R.color.pingle_yellow, backgroundChipColor = R.color.chip_yellow, backgroundBadgeColor = R.color.badge_yellow, - categoryNameRes = R.string.category_multi + categoryNameRes = R.string.category_multi, + categoryDescriptionRes = R.string.category_multi_detail ), OTHERS( textColor = R.color.g_01, activatedOutLinedColor = R.color.g_01, backgroundChipColor = R.color.g_10, backgroundBadgeColor = R.color.g_07, - categoryNameRes = R.string.category_others + categoryNameRes = R.string.category_others, + categoryDescriptionRes = R.string.category_others_detail ); companion object { diff --git a/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanActivity.kt b/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanActivity.kt index 82bf3f4e..995f5d9c 100644 --- a/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanActivity.kt +++ b/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanActivity.kt @@ -29,6 +29,7 @@ class PlanActivity : BindingActivity(R.layout.activity_plan // TODO 차후에 나머지 개최 프로세스 fragment 추가 fragmentList = ArrayList() fragmentList.apply { + add(PlanCategoryFragment()) add(PlanTitleFragment()) add(PlanDateTimeFragment()) add(PlanLocationFragment()) diff --git a/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanCategoryFragment.kt b/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanCategoryFragment.kt new file mode 100644 index 00000000..f9208c0b --- /dev/null +++ b/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanCategoryFragment.kt @@ -0,0 +1,38 @@ +package org.sopt.pingle.presentation.ui.main.plan + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.viewModels +import org.sopt.pingle.R +import org.sopt.pingle.databinding.FragmentPlanCategoryBinding +import org.sopt.pingle.util.base.BindingFragment + +class PlanCategoryFragment : + BindingFragment(R.layout.fragment_plan_category) { + private val planViewModel by viewModels() + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + binding.planViewModel = planViewModel + binding.lifecycleOwner = this + + initLayout() + addListeners() + } + + private fun initLayout() { + } + + private fun addListeners() { + with(binding) { + includePlanCategoryTypePlay.root.setOnClickListener { + } + includePlanCategoryTypeStudy.root.setOnClickListener { + } + includePlanCategoryTypeMulti.root.setOnClickListener { + } + includePlanCategoryTypeOthers.root.setOnClickListener { + } + } + } +} diff --git a/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanViewModel.kt b/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanViewModel.kt index a697aefc..c7140c70 100644 --- a/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanViewModel.kt +++ b/app/src/main/java/org/sopt/pingle/presentation/ui/main/plan/PlanViewModel.kt @@ -8,6 +8,7 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.stateIn +import org.sopt.pingle.presentation.type.CategoryType import org.sopt.pingle.presentation.type.PlanType class PlanViewModel : ViewModel() { @@ -44,6 +45,14 @@ class PlanViewModel : ViewModel() { private val _address = MutableStateFlow(null) val address get() = _address.asStateFlow() + // TODO 뷰 연결 시 버튼 활성/비활성화 로직 isPlanBtnEnabled에 추가 + private val _selectedCategory = MutableStateFlow(null) + val selectedCategory get() = _selectedCategory.asStateFlow() + + fun setSelectedCategory(categoryType: CategoryType) { + _selectedCategory.value = categoryType + } + fun setCurrentPage(position: Int) { _currentPage.value = position } diff --git a/app/src/main/java/org/sopt/pingle/util/base/BindingAdapter.kt b/app/src/main/java/org/sopt/pingle/util/base/BindingAdapter.kt index 93340737..ddf57765 100644 --- a/app/src/main/java/org/sopt/pingle/util/base/BindingAdapter.kt +++ b/app/src/main/java/org/sopt/pingle/util/base/BindingAdapter.kt @@ -2,6 +2,7 @@ package org.sopt.pingle.util.base import android.view.View import android.widget.ImageView +import android.widget.TextView import androidx.core.content.ContextCompat import androidx.databinding.BindingAdapter @@ -11,6 +12,17 @@ fun setImageResource(imageView: ImageView, resId: Int) { imageView.setImageDrawable(drawable) } +@BindingAdapter("color") +fun setTextColor(textView: TextView, resId: Int) { + val colorRes = ContextCompat.getColor(textView.context, resId) + textView.setTextColor(colorRes) +} + +@BindingAdapter("selection") +fun setSelected(view: View, isSelected: Boolean) { + view.isSelected = isSelected +} + @BindingAdapter("visibility") fun View.setVisibility(isVisible: Boolean?) { if (isVisible == null) { diff --git a/app/src/main/res/drawable/background_disabled_plan_location_category.xml b/app/src/main/res/drawable/background_disabled_plan_location_category.xml new file mode 100644 index 00000000..d09bf503 --- /dev/null +++ b/app/src/main/res/drawable/background_disabled_plan_location_category.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_enabled_plan_location_category.xml b/app/src/main/res/drawable/background_enabled_plan_location_category.xml new file mode 100644 index 00000000..0867e829 --- /dev/null +++ b/app/src/main/res/drawable/background_enabled_plan_location_category.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_item_plan_location_category.xml b/app/src/main/res/drawable/selector_item_plan_location_category.xml new file mode 100644 index 00000000..90445a7b --- /dev/null +++ b/app/src/main/res/drawable/selector_item_plan_location_category.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_plan_category.xml b/app/src/main/res/layout/fragment_plan_category.xml new file mode 100644 index 00000000..0bda598b --- /dev/null +++ b/app/src/main/res/layout/fragment_plan_category.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/view_plan_category_type.xml b/app/src/main/res/layout/view_plan_category_type.xml new file mode 100644 index 00000000..9faa35c8 --- /dev/null +++ b/app/src/main/res/layout/view_plan_category_type.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 74f5eda8..d54ecfdf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,6 +6,10 @@ STUDY MULTI OTHERS + 노는게 제일 좋아! + 열공, 열작업 할 사람 모여라! + 놀 땐 놀고, 일할 땐 일하자! + 다른 활동이 하고 싶다면? @@ -87,4 +91,7 @@ 나가기 검색 결과가 없어요 다른 장소로 검색해보세요 + + + 개최할 핑글을\n선택해주세요 \ No newline at end of file