Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into ui/#30-trip-dash-board
  • Loading branch information
leeeyubin committed Jan 7, 2024
2 parents 02dc262 + 95bb516 commit 4601472
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 87 deletions.
9 changes: 6 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,18 @@
<activity
android:name="com.going.presentation.onboarding.OnboardingProfileSettingActivity"
android:exported="false"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"/>


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

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

<activity
android:name="com.going.presentation.preferencetag.PreferenceTagActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ class OnboardingProfileSettingActivity :
setBackground: (Int) -> Unit,
) {
val (color, background) = when {
viewModel.isNameAvailable.value != NameState.Blank && hasFocus -> R.color.gray_700 to R.drawable.sel_rounded_corner_edit_text
length == 0 -> R.color.gray_200 to R.drawable.sel_rounded_corner_edit_text_empty
viewModel.isNameAvailable.value == NameState.Blank && counter == binding.tvNameCounter -> R.color.red_500 to R.drawable.sel_rounded_corner_edit_text_error
else -> R.color.gray_700 to R.drawable.sel_rounded_corner_edit_text
viewModel.isNameAvailable.value != NameState.Blank && hasFocus -> R.color.gray_700 to R.drawable.shape_rect_4_gray700_line
length == 0 -> R.color.gray_200 to R.drawable.shape_rect_4_gray200_line
viewModel.isNameAvailable.value == NameState.Blank && counter == binding.tvNameCounter -> R.color.red_500 to R.drawable.shape_rect_4_red500_line
else -> R.color.gray_700 to R.drawable.shape_rect_4_gray700_line
}

setCounterColor(counter, color)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import android.os.Bundle
import android.view.animation.DecelerateInterpolator
import android.widget.ProgressBar
import androidx.activity.viewModels
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.going.presentation.R
import com.going.presentation.databinding.ActivityTendencyTestBinding
import com.going.ui.base.BaseActivity
import com.going.ui.extension.setOnSingleClickListener
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach

class TendencyTestActivity :
BaseActivity<ActivityTendencyTestBinding>(R.layout.activity_tendency_test) {
Expand All @@ -26,6 +30,7 @@ class TendencyTestActivity :
initFadeAnimation()
initFadeListener()
initNextBtnClickListener()
observeButtonSelected()
}

private fun initBindingViewModel() {
Expand All @@ -34,31 +39,31 @@ class TendencyTestActivity :

private fun initFadeAnimation() {
fadeOutList = listOf<ObjectAnimator>(
ObjectAnimator.ofFloat(binding.tvFirstAnswer, "alpha", 1f, 0f).apply {
ObjectAnimator.ofFloat(binding.tvFirstAnswer, ALPHA, 1f, 0f).apply {
duration = DURATION
},
ObjectAnimator.ofFloat(binding.tvSecondAnswer, "alpha", 1f, 0f).apply {
ObjectAnimator.ofFloat(binding.tvSecondAnswer, ALPHA, 1f, 0f).apply {
duration = DURATION
},
ObjectAnimator.ofFloat(binding.tvThirdAnswer, "alpha", 1f, 0f).apply {
ObjectAnimator.ofFloat(binding.tvThirdAnswer, ALPHA, 1f, 0f).apply {
duration = DURATION
},
ObjectAnimator.ofFloat(binding.tvFourthAnswer, "alpha", 1f, 0f).apply {
ObjectAnimator.ofFloat(binding.tvFourthAnswer, ALPHA, 1f, 0f).apply {
duration = DURATION
},
)

fadeInList = listOf<ObjectAnimator>(
ObjectAnimator.ofFloat(binding.tvFirstAnswer, "alpha", 0f, 1f).apply {
ObjectAnimator.ofFloat(binding.tvFirstAnswer, ALPHA, 0f, 1f).apply {
duration = DURATION
},
ObjectAnimator.ofFloat(binding.tvSecondAnswer, "alpha", 0f, 1f).apply {
ObjectAnimator.ofFloat(binding.tvSecondAnswer, ALPHA, 0f, 1f).apply {
duration = DURATION
},
ObjectAnimator.ofFloat(binding.tvThirdAnswer, "alpha", 0f, 1f).apply {
ObjectAnimator.ofFloat(binding.tvThirdAnswer, ALPHA, 0f, 1f).apply {
duration = DURATION
},
ObjectAnimator.ofFloat(binding.tvFourthAnswer, "alpha", 0f, 1f).apply {
ObjectAnimator.ofFloat(binding.tvFourthAnswer, ALPHA, 0f, 1f).apply {
duration = DURATION
},
)
Expand Down Expand Up @@ -95,7 +100,7 @@ class TendencyTestActivity :
}

private fun setProgressAnimate(pb: ProgressBar, progressTo: Int) =
ObjectAnimator.ofInt(pb, "progress", pb.progress, progressTo * 100).apply {
ObjectAnimator.ofInt(pb, PROGRESS, pb.progress, progressTo * 100).apply {
duration = DURATION
setAutoCancel(true)
interpolator = DecelerateInterpolator()
Expand All @@ -115,7 +120,34 @@ class TendencyTestActivity :
// 페이지 이동 기능 추가 예정
}

private fun observeButtonSelected() {
viewModel.isFirstChecked.flowWithLifecycle(lifecycle).onEach {
binding.tvFirstAnswer.setTextAppearance(setFont(it))
}.launchIn(lifecycleScope)

viewModel.isSecondChecked.flowWithLifecycle(lifecycle).onEach {
binding.tvSecondAnswer.setTextAppearance(setFont(it))
}.launchIn(lifecycleScope)

viewModel.isThirdChecked.flowWithLifecycle(lifecycle).onEach {
binding.tvThirdAnswer.setTextAppearance(setFont(it))
}.launchIn(lifecycleScope)

viewModel.isFourthChecked.flowWithLifecycle(lifecycle).onEach {
binding.tvFourthAnswer.setTextAppearance(setFont(it))
}.launchIn(lifecycleScope)
}

private fun setFont(checked: Boolean) = if (checked) {
R.style.TextAppearance_Doorip_Body3_Bold
} else {
R.style.TextAppearance_Doorip_Body3_Medi
}

companion object {
const val DURATION = 500L

const val PROGRESS = "progress"
const val ALPHA = "alpha"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class TendencyTestSplashActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initStartBtnSingleClickListener()
initStartBtnClickListener()
}

private fun initStartBtnSingleClickListener() {
private fun initStartBtnClickListener() {
binding.btnTendencySplashStart.setOnSingleClickListener {
// 페이지 이동~
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import kotlinx.coroutines.flow.MutableStateFlow
class TendencyTestViewModel : ViewModel() {
val step = MutableStateFlow(1)
val isChecked = MutableLiveData(false)
val isFirstChecked = MutableLiveData(false)
val isSecondChecked = MutableLiveData(false)
val isThirdChecked = MutableLiveData(false)
val isFourthChecked = MutableLiveData(false)
val isFirstChecked = MutableStateFlow(false)
val isSecondChecked = MutableStateFlow(false)
val isThirdChecked = MutableStateFlow(false)
val isFourthChecked = MutableStateFlow(false)

val tendencyResultList: MutableList<Int> = MutableList(9) { 0 }

Expand Down
10 changes: 0 additions & 10 deletions presentation/src/main/res/drawable/sel_radiobutton_checked.xml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

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">
<stroke android:width="1dp"/>
<stroke android:color="@color/gray_200"/>
<corners android:radius="4dp" />
</shape>
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">
<stroke android:width="1dp"/>
<stroke android:color="@color/gray_700"/>
<corners android:radius="4dp" />
</shape>
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">
<stroke android:width="1dp"/>
<stroke android:color="@color/red_500"/>
<corners android:radius="4dp" />
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp" />
<solid android:color="@color/gray_50" />
</shape>
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">
<stroke android:width="1dp" />
<stroke android:color="@color/red_500" />
<corners android:radius="8dp" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>
<import type="android.view.View"/>
<import type="com.going.domain.entity.NameState"/>

<import type="android.view.View" />

<import type="com.going.domain.entity.NameState" />

<variable
name="viewModel"
type="com.going.presentation.onboarding.OnboardingProfileSettingViewModel" />
Expand All @@ -26,10 +29,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:title="@string/onboarding_tb_title"
app:titleTextAppearance="@style/TextAppearance.Doorip.Body1.Bold"
app:titleTextColor="@color/black_000" />

<TextView
android:id="@+id/tv_onboarding_profile_setting_name_title"
style="@style/TextAppearance.Doorip.Body3.Bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
Expand All @@ -46,17 +51,19 @@
android:layout_marginHorizontal="24dp"
android:layout_marginTop="6dp"
android:afterTextChanged="@{(text) -> viewModel.checkProfileAvailable()}"
android:background="@drawable/sel_rounded_corner_edit_text_empty"
android:background="@drawable/shape_rect_4_gray200_line"
android:hint="@string/onboarding_et_name_hint"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
android:text="@={viewModel.name}"
android:textAppearance="@style/TextAppearance.Doorip.Detail1.Regular"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_onboarding_profile_setting_name_title" />

<TextView
style="@style/TextAppearance.Doorip.Detail3.Regular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
Expand All @@ -79,6 +86,7 @@

<TextView
android:id="@+id/tv_onboarding_profile_setting_on_line_info_title"
style="@style/TextAppearance.Doorip.Body3.Bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="37dp"
Expand All @@ -95,12 +103,13 @@
android:layout_marginHorizontal="24dp"
android:layout_marginTop="6dp"
android:afterTextChanged="@{(text) -> viewModel.checkProfileAvailable()}"
android:background="@drawable/sel_rounded_corner_edit_text_empty"
android:background="@drawable/shape_rect_4_gray200_line"
android:hint="@string/onboarding_one_line_et_info"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLines="1"
android:text="@={viewModel.info}"
android:textAppearance="@style/TextAppearance.Doorip.Detail1.Regular"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_onboarding_profile_setting_on_line_info_title" />
Expand Down
Loading

0 comments on commit 4601472

Please sign in to comment.