-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] 핑글 개최 프로세스 - 카테고리 선택 뷰 구현 #56
Changes from all commits
f56a93d
3d03f1f
a64ecaa
16fe306
85672f3
f75dfa1
62e8e40
407c940
f04a635
4b7a997
dbf6805
104cc4d
0a576d0
abba367
7bdc447
5b1856b
831a935
c6fcaf4
498d3ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<FragmentPlanCategoryBinding>(R.layout.fragment_plan_category) { | ||
private val planViewModel by viewModels<PlanViewModel>() | ||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
binding.planViewModel = planViewModel | ||
binding.lifecycleOwner = this | ||
|
||
initLayout() | ||
addListeners() | ||
} | ||
|
||
private fun initLayout() { | ||
} | ||
|
||
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 사용하지 않는 함수 지워주세요. |
||
private fun addListeners() { | ||
with(binding) { | ||
includePlanCategoryTypePlay.root.setOnClickListener { | ||
} | ||
includePlanCategoryTypeStudy.root.setOnClickListener { | ||
} | ||
includePlanCategoryTypeMulti.root.setOnClickListener { | ||
} | ||
includePlanCategoryTypeOthers.root.setOnClickListener { | ||
} | ||
} | ||
} | ||
Comment on lines
+26
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기도 지워주세요 |
||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
그리고 이 파일 없어져도 될 것 같습니다! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/g_10"/> | ||
<corners android:radius="10dp"/> | ||
</shape> |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
네이밍 컨벤션 지켜주세요 그리고 다음과 같은 형식으로 작성해주세요
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="@color/g_10"/> | ||
<stroke | ||
android:width="1dp" | ||
android:color="@color/white"/> | ||
<corners android:radius="10dp"/> | ||
</shape> |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요기서도 아까 말했던 drawable 파일 사용해주면 되겠죠?? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@drawable/background_disabled_plan_location_category" android:state_selected="false"/> | ||
<item android:drawable="@drawable/background_enabled_plan_location_category" android:state_selected="true"/> | ||
</selector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<data> | ||
<variable | ||
name="planViewModel" | ||
type="org.sopt.pingle.presentation.ui.main.plan.PlanViewModel" /> | ||
|
||
<import type="org.sopt.pingle.presentation.type.CategoryType"></import> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 어제 말했던 방식으로 해보고 얘 지워도되나 테스트 부탁해요 ~ |
||
<variable | ||
name="planCategory" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. categoryType으로 작성하는 게 더 가독성 좋을 듯 요 |
||
type="org.sopt.pingle.presentation.type.CategoryType" /> | ||
</data> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".presentation.ui.plan.PlanLocationFragment"> | ||
|
||
<TextView | ||
android:id="@+id/tv_plan_location_title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/spacing8" | ||
android:text="@string/plan_category_title" | ||
android:textAppearance="@style/TextAppearance.Pingle.Title.Semi.24" | ||
android:textColor="@color/white" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/layout_plan_category_topCategory" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/spacing28" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/tv_plan_location_title"> | ||
|
||
<include | ||
android:id="@+id/include_plan_category_type_play" | ||
layout="@layout/view_plan_category_type" | ||
android:layout_width="wrap_content" | ||
android:layout_height="0dp" | ||
selection="@{planViewModel.selectedCategory == planCategory.PLAY}" | ||
android:onClick="@{()->planViewModel.setSelectedCategory(planCategory.PLAY)}" | ||
app:categoryType="@{planCategory.PLAY}" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
<include | ||
android:id="@+id/include_plan_category_type_study" | ||
layout="@layout/view_plan_category_type" | ||
android:layout_width="wrap_content" | ||
android:layout_height="0dp" | ||
selection="@{planViewModel.selectedCategory == planCategory.STUDY}" | ||
android:onClick="@{()->planViewModel.setSelectedCategory(planCategory.STUDY)}" | ||
android:layout_marginStart="@dimen/spacing9" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 간격 10 아닌가요? |
||
app:categoryType="@{planCategory.STUDY}" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 지워주세요 |
||
app:layout_constraintStart_toEndOf="@id/include_plan_category_type_play" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
Comment on lines
+33
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 두 개 씩 constraintLayout으로 묶어준 이유는 가운데 정렬을 하기 위함인가요? 잘 이해가 안 간다면 건빵 필터 선택 뷰의 빵 유형 선택 뷰가 이와 비슷한 형태이니 그걸 참고해주시면 좋을 것 같습니다 ! (체인을 적절하게 사용해주세요 ~) |
||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/layout_plan_category_bottomCategory" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/spacing11" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/layout_plan_category_topCategory"> | ||
|
||
<include | ||
android:id="@+id/include_plan_category_type_multi" | ||
layout="@layout/view_plan_category_type" | ||
android:layout_width="wrap_content" | ||
android:layout_height="0dp" | ||
Comment on lines
+78
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. width -> 0dp 이유는 왤까요? |
||
selection="@{planViewModel.selectedCategory == planCategory.MULTI}" | ||
android:onClick="@{()->planViewModel.setSelectedCategory(planCategory.MULTI)}" | ||
app:categoryType="@{planCategory.MULTI}" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
<include | ||
android:id="@+id/include_plan_category_type_others" | ||
layout="@layout/view_plan_category_type" | ||
android:layout_width="wrap_content" | ||
android:layout_height="0dp" | ||
selection="@{planViewModel.selectedCategory == planCategory.OTHERS}" | ||
android:onClick="@{()->planViewModel.setSelectedCategory(planCategory.OTHERS)}" | ||
android:layout_marginStart="@dimen/spacing9" | ||
app:categoryType="@{planCategory.OTHERS}" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/include_plan_category_type_multi" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
Comment on lines
+66
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기도 위와 동일합니다. 불필요한 depth를 줄여주세요 |
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</layout> |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기 뷰 잘 짰네요!! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<data> | ||
|
||
<variable | ||
name="planViewModel" | ||
type="org.sopt.pingle.presentation.ui.main.plan.PlanViewModel" /> | ||
|
||
Comment on lines
+8
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기에 뷰모델을 추가할 필요는 없어 보입니다 제거해주세요 |
||
<variable | ||
name="categoryType" | ||
type="org.sopt.pingle.presentation.type.CategoryType" /> | ||
|
||
<import type="org.sopt.pingle.presentation.type.CategoryType" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이것도 부탁ㅎㅐ용 |
||
</data> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@drawable/selector_item_plan_location_category"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요거 배경 바꾸면서 background tint 조절 고고 |
||
|
||
<!--TODO image="@{categoryType.categoryIconRes}" --> | ||
<ImageView | ||
android:id="@+id/iv_plan_category_type" | ||
android:layout_width="84dp" | ||
android:layout_height="84dp" | ||
Comment on lines
+27
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 에셋 나오면 wrap_content나 0dp 로 설정해주는 거 알죵? |
||
android:layout_marginHorizontal="38dp" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 좌우 정렬을 모두 했으므로 이 마진값 제거해주세요 |
||
android:layout_marginTop="@dimen/spacing13" | ||
android:src="@drawable/ic_all_warning_notice_24" | ||
app:layout_constraintDimensionRatio="1" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_plan_category_name" | ||
color="@{categoryType.textColor}" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/spacing3" | ||
android:background="@color/g_10" | ||
android:text="@{categoryType.categoryNameRes}" | ||
android:textAppearance="@style/TextAppearance.Pingle.Title.Semi.20" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bold 18 |
||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/iv_plan_category_type" | ||
tools:text="PLAY" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_plan_category_description" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/spacing3" | ||
android:layout_marginBottom="20dp" | ||
android:text="@{categoryType.categoryDescriptionRes}" | ||
android:textAppearance="@style/TextAppearance.Pingle.Cap.Med.12" | ||
android:textColor="@color/g_04" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/tv_plan_category_name" | ||
tools:text="설명 텍스트 미정" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</layout> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,10 @@ | |
<string name="category_study">STUDY</string> | ||
<string name="category_multi">MULTI</string> | ||
<string name="category_others">OTHERS</string> | ||
<string name="category_play_detail">노는게 제일 좋아!</string> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 타입에서 선언한 이름대로 |
||
<string name="category_study_detail">열공, 열작업 할 사람 모여라!</string> | ||
<string name="category_multi_detail">놀 땐 놀고, 일할 땐 일하자!</string> | ||
<string name="category_others_detail">다른 활동이 하고 싶다면?</string> | ||
|
||
<!-- all navi title --> | ||
<string name="all_navi_home">홈</string> | ||
|
@@ -87,4 +91,7 @@ | |
<string name="plan_location_quit"><u>나가기</u></string> | ||
<string name="plan_location_empty">검색 결과가 없어요</string> | ||
<string name="plan_location_empty_info">다른 장소로 검색해보세요</string> | ||
|
||
<!-- plan Category --> | ||
<string name="plan_category_title">개최할 핑글을\n선택해주세요</string> | ||
</resources> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 이미 BindingFragmen에 있어서 적용해주지 않아도 됩니다.
또한, Fragment에서 lifecycleOwner를 잘 설정해주는 것이 중요한데요. 여기서 this를 사용하는 것이 적절할까요?
어떤 걸 쓰면 좋을지 고민해보구 그 이유를 알려주세용