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/#216] 취향 태그 뷰 / UI 구현 #224

Merged
merged 12 commits into from
Mar 4, 2024
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.going.presentation.todo.ourtodo.checkfriends

import android.os.Bundle
import android.view.View
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.style.ForegroundColorSpan
import androidx.activity.viewModels
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
Expand All @@ -10,9 +12,10 @@ import com.going.presentation.R
import com.going.presentation.databinding.ActivityCheckFriendsBinding
import com.going.presentation.todo.TodoActivity.Companion.EXTRA_TRIP_ID
import com.going.ui.base.BaseActivity
import com.going.ui.state.UiState
import com.going.ui.extension.colorOf
import com.going.ui.extension.setOnSingleClickListener
import com.going.ui.extension.toast
import com.going.ui.state.UiState
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand All @@ -34,6 +37,7 @@ class CheckFriendsActivity :
initAdapter()
getTripId()
observeCheckFriendsListState()
setResultTextColor()

}

Expand Down Expand Up @@ -70,11 +74,11 @@ class CheckFriendsActivity :
private fun setFriendsData(data: CheckFriendsModel) {
adapter.submitList(data.participants)
val rate = data.styles.map { it.rate }
val isLeft = data.styles.map { it.isLeft }
setProgressBarStatus(rate, isLeft)
setProgressBarStatus(rate)
}

private fun setProgressBarStatus(rate: List<Int>, isLeft: List<Boolean>) {
private fun setProgressBarStatus(rate: List<Int>) {

val progressBars = listOf(
binding.progressBarCheckFriends1,
binding.progressBarCheckFriends2,
Expand All @@ -83,23 +87,20 @@ class CheckFriendsActivity :
binding.progressBarCheckFriends5
)

val progressBarsRevert = listOf(
binding.progressBarCheckFriends1Revert,
binding.progressBarCheckFriends2Revert,
binding.progressBarCheckFriends3Revert,
binding.progressBarCheckFriends4Revert,
binding.progressBarCheckFriends5Revert
)

for (i in rate.indices) {
if (isLeft[i]) {
progressBars[i].visibility = View.VISIBLE
progressBarsRevert[i].visibility = View.INVISIBLE
progressBars[i].progress = rate[i]
} else {
progressBars[i].visibility = View.INVISIBLE
progressBarsRevert[i].visibility = View.VISIBLE
progressBarsRevert[i].progress = rate[i]
progressBars[i].progress = rate[i]
}

}

private fun setResultTextColor() {
binding.tvCheckFriendsResult.apply {
text = SpannableStringBuilder(text).apply {
setSpan(
ForegroundColorSpan(
colorOf(R.color.red_500)
), 0, 9, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
Comment on lines +96 to +102
Copy link
Contributor

Choose a reason for hiding this comment

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

요부분으로 프로그래스바 색 다르게 구현하는군요!!!
역시 오비 이유빈.. 다르다..👍👍

Copy link
Member Author

Choose a reason for hiding this comment

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

엇 요 부분은 성향 검사 결과 Text의 색깔을 다르게 구현하는 함수입니다!

프로그레스바 색상은 layer_list_trip_friends_progress_bar.xml파일에 미리 만들어두었어요!
추후에 서버에서 값 넘겨주면 setProgressBarStatus() 함수에서 값만 쇽샥 넣어줄 예정입니당

Copy link
Contributor

Choose a reason for hiding this comment

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

아!! 요부분은 텍스트 색깔이군엽 설명 감사합니당!

)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
Copy link
Member

Choose a reason for hiding this comment

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

이제 레이어 리스트 마스터했네요 ㅎㅎㅎㅎ

<item android:id="@android:id/background">
<shape>
<corners android:radius="4dp"/>
<solid android:color="@color/gray_50"/>
<corners android:radius="3dp" />
<solid android:color="@color/gray_100" />
</shape>
</item>

<item android:id="@android:id/progress">
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="4dp"/>
<solid android:color="@color/gray_400"/>
<corners android:radius="3dp" />
<solid android:color="@color/gray_300" />
</shape>
</clip>
<clip android:top="2dp" android:bottom="2dp" android:left="2dp" android:right="2dp">
</item>

<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/gray_400"/>
<corners android:radius="3dp" />
<solid android:color="@color/gray_400" />
</shape>
</clip>
</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/gray_50" />
<stroke android:width="6.35dp" />
Copy link
Member

Choose a reason for hiding this comment

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

6으로 하면 피그마랑 너무 달라지나요? 소수점 사용을 지양합시다 !

Copy link
Member Author

Choose a reason for hiding this comment

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

피그마에서 디쟌선생님들이 6.35로 줘서 그대로 반영했었습니닷,, 사실 6으로 해도 상관 없을 것 같아서 6으로 수정하겠습니다!

<stroke android:color="@color/gray_50" />
<corners android:radius="6dp" />
</shape>
Loading
Loading