Skip to content
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

[UI/#44] 취향 태그 뷰 / UI 수정 #49

Merged
merged 11 commits into from
Jan 9, 2024
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

<activity
android:name="com.going.presentation.tendencytest.result.TendencyTestResultActivity"
android:exported="true"
android:exported="false"
android:screenOrientation="portrait" />

<activity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.going.domain.entity

data class PreferenceData(
val number: Int,
val leftPrefer: String,
val number: String,
val question : String,
val rightPrefer: String,
val leftPrefer : String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.going.domain.entity.PreferenceData
import com.going.presentation.R
import com.going.presentation.databinding.ActivityPreferenceTagBinding
import com.going.ui.base.BaseActivity
import com.going.ui.extension.toast
import com.going.ui.extension.setOnSingleClickListener

class PreferenceTagActivity :
BaseActivity<ActivityPreferenceTagBinding>(R.layout.activity_preference_tag),
Expand All @@ -21,14 +21,29 @@ class PreferenceTagActivity :
super.onCreate(savedInstanceState)

initAdapter()
initItemDecoration()
initBackClickListener()
Comment on lines 23 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 함수화 좋습니다~


}


private fun initAdapter() {
_adapter = PreferenceTagAdapter(this, this)
binding.rvPreferenceTag.adapter = adapter
adapter.submitList(viewModel.preferenceTagList)
}

private fun initItemDecoration() {
val itemDeco = PreferenceTagDecoration(this)
binding.rvPreferenceTag.addItemDecoration(itemDeco)
}

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

override fun onPreferenceSelected(preference: PreferenceData) {
// 선택된 취향 태그 처리
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.going.presentation.preferencetag

import android.content.Context
import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView

class PreferenceTagDecoration (val context: Context) : RecyclerView.ItemDecoration() {

override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
super.getItemOffsets(outRect, view, parent, state)
val position = parent.getChildAdapterPosition(view)

if (position == 0) outRect.top = 50
else outRect.top = 0
outRect.bottom = 10
Comment on lines +19 to +21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리사이클러뷰를 이렇게......진짜 유빈 갓이네

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ class PreferenceTagViewHolder(

fun onBind(item: PreferenceData) {
binding.run {
tvPreferenceNumber.text = item.number.toString()
tvPreferenceLeft.text = item.leftPrefer
tvPreferenceRight.text = item.rightPrefer
tvPreferenceNumber.text = item.number
tvPreferenceQuestion.text = item.question
tvPreferenceTag1.text = item.leftPrefer
tvPreferenceTag3.text = item.rightPrefer

rgPreferenceTag.setOnCheckedChangeListener { _, checkedId ->
val selectedButtonIdList = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,34 @@ class PreferenceTagViewModel : ViewModel() {

val preferenceTagList = listOf<PreferenceData>(
PreferenceData(
number = 1,
leftPrefer = "휴식",
rightPrefer = "관광"
number = "01",
question = "계획은 얼만큼 짤까요?",
leftPrefer = "철저하게",
rightPrefer = "즉흥으로"
),
PreferenceData(
number = 2,
number = "02",
question = "장소선택의 기준은 무엇인가요?",
leftPrefer = "관광지",
rightPrefer = "로컬 플레이스"
rightPrefer = "로컬장소"
),
PreferenceData(
number = 3,
leftPrefer = "철처한 계획",
number = "03",
question = "음식을 고를 때 무엇을 더 중요시 하나요?",
leftPrefer = "철저한 계획",
rightPrefer = "무계획"
),
PreferenceData(
number = 4,
leftPrefer = "찾아온 맛집",
rightPrefer = "끌리는 곳"
number = "04",
question = "멋진 풍경이 보이면?",
leftPrefer = "사진 필수",
rightPrefer = "눈에 담기"
),
PreferenceData(
number = 5,
leftPrefer = "느긋하게",
rightPrefer = "효율적으로"
number = "05",
question = "스케줄 구성은 어떻게 할까요?",
leftPrefer = "알차게",
rightPrefer = "여유롭게"
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class CompletedTripFragment :
super.onViewCreated(view, savedInstanceState)

setRecyclerView()
initItemDecoration()

}

Expand All @@ -35,6 +36,11 @@ class CompletedTripFragment :
adapter.submitList(viewModel.mockCompletedList)
}

private fun initItemDecoration() {
val itemDeco = DashBoardDecoration(requireContext())
binding.rvDashboardCompletedTrip.addItemDecoration(itemDeco)
}

override fun onDestroyView() {
super.onDestroyView()
_adapter = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView

class TripDecoration(val context: Context) : RecyclerView.ItemDecoration() {
class DashBoardDecoration(val context: Context) : RecyclerView.ItemDecoration() {

override fun getItemOffsets(
outRect: Rect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OngoingTripFragment :
}

private fun initItemDecoration() {
val itemDeco = TripDecoration(requireContext())
val itemDeco = DashBoardDecoration(requireContext())
binding.rvDashboardOngoingTrip.addItemDecoration(itemDeco)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.going.presentation.tripdashboard.triplist

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.going.domain.entity.response.OngoingListModel
import com.going.presentation.R
import com.going.presentation.databinding.ItemDashBoardOngoingBinding
import com.going.ui.extension.setOnSingleClickListener

Expand All @@ -12,17 +12,17 @@ class OngoingViewHolder(
) : RecyclerView.ViewHolder(binding.root) {

fun onBind(item: OngoingListModel) {

binding.run {
tvDashboardTripTitle.text = item.title
tvDashboardDateStart.text = item.startDate
tvDashboardDateEnd.text = item.endDate

if (item.day <= 0) {
layoutDashboardTraveling.visibility = View.VISIBLE
layoutDashboardDayLeft.visibility = View.INVISIBLE
tvDashboardDeadline.text =
itemView.context.getString(R.string.dashboard_tv_traveling)
} else {
tvDashboardDeadlineDay.text = item.day.toString()
tvDashboardDeadline.text =
itemView.context.getString(R.string.dashboard_tv_deadline, item.day)
}

layoutDashboard.setOnSingleClickListener {
Expand Down
21 changes: 21 additions & 0 deletions presentation/src/main/res/drawable/ic_preference_tag_blur.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="360dp"
android:height="104dp"
android:viewportWidth="360"
android:viewportHeight="104">
<path
android:pathData="M0,0h360v104h-360z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="180"
android:startY="0"
android:endX="180"
android:endY="104"
android:type="linear">
<item android:offset="0" android:color="#00F3F3F6"/>
<item android:offset="0.28" android:color="#FFF3F3F6"/>
</gradient>
</aapt:attr>
</path>
</vector>
10 changes: 10 additions & 0 deletions presentation/src/main/res/drawable/ic_preference_union.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="22dp"
android:viewportWidth="34"
android:viewportHeight="22">
<path
android:pathData="M16.907,20.194C15.187,21.336 13.128,22 10.914,22C4.886,22 0,17.075 0,11C0,4.925 4.886,0 10.914,0C13.128,0 15.187,0.664 16.907,1.806C18.647,0.664 20.729,0 22.967,0C29.061,0 34.001,4.925 34.001,11C34.001,17.075 29.061,22 22.967,22C20.729,22 18.647,21.336 16.907,20.194Z"
android:fillColor="#FF4F17"
android:fillType="evenOdd"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/white_000" />
</shape>
</item>
<item
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:color="@color/gray_200" />
</shape>
</item>
</layer-list>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape>
<solid android:color="@color/black_000" />
<corners android:radius="24dp" />
<solid android:color="@color/gray_400" />
<corners android:radius="4dp" />
Comment on lines +5 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디자인 반영 좋아요~ gray 700 좋습니다~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

푸하하 gray_400이지롱

</shape>
</item>

<item android:state_checked="false">
<shape>
<solid android:color="@color/gray_300" />
<corners android:radius="24dp" />
<solid android:color="@color/gray_50" />
<corners android:radius="4dp" />
</shape>
</item>
</selector>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dp"/>
<stroke android:color="@color/gray_100"/>
<stroke android:color="@color/gray_200"/>
<solid android:color="@color/white_000" />
<corners android:radius="4dp" />
</shape>
61 changes: 45 additions & 16 deletions presentation/src/main/res/layout/activity_preference_tag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,71 @@
android:background="@color/white_000"
tools:context=".preferencetag.PreferenceTagActivity">

<TextView
android:id="@+id/tv_preference_title"
android:layout_width="wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_preference_tag"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:fontFamily="@font/pretendard_bold"
android:text="@string/preference_tv_title"
android:textColor="@color/black_000"
android:textSize="18sp"
android:background="@drawable/layer_list_preference_tag_gray200_line"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/btn_preference_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="18dp"
android:layout_marginBottom="4dp"
android:src="@drawable/ic_back"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
style="@style/TextAppearance.Doorip.Body1.Bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="@string/preference_tv_title"
android:textColor="@color/gray_700"
app:layout_constraintBottom_toBottomOf="@id/btn_preference_back"
app:layout_constraintStart_toEndOf="@id/btn_preference_back"
app:layout_constraintTop_toTopOf="@id/btn_preference_back" />


</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_preference_tag"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/gray_200"
android:paddingTop="17dp"
android:background="@color/gray_50"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@id/btn_preference_start"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_preference_title"
app:layout_constraintTop_toBottomOf="@id/layout_preference_tag"
tools:listitem="@layout/item_preference_tag" />

<ImageView
android:id="@+id/iv_preference_blur"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_preference_tag_blur"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_preference_start"
style="@style/button_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="18dp"
android:layout_marginBottom="50dp"
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="22dp"
android:background="@drawable/sel_rounded_corner_button"
android:backgroundTint="@color/black_000"
android:text="@string/preference_btn_start"
android:backgroundTint="@color/gray_500"
android:text="@string/preference_btn_next"
android:textColor="@color/white_000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="20dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
Loading