diff --git a/presentation/src/main/java/com/going/presentation/onboarding/OnboardingProfileSettingActivity.kt b/presentation/src/main/java/com/going/presentation/onboarding/OnboardingProfileSettingActivity.kt index 37e602ba..7e7aedfe 100644 --- a/presentation/src/main/java/com/going/presentation/onboarding/OnboardingProfileSettingActivity.kt +++ b/presentation/src/main/java/com/going/presentation/onboarding/OnboardingProfileSettingActivity.kt @@ -2,7 +2,9 @@ package com.going.presentation.onboarding import android.os.Bundle import android.view.inputmethod.EditorInfo +import android.widget.TextView import androidx.activity.viewModels +import androidx.core.content.res.ResourcesCompat import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import com.going.domain.entity.NameState @@ -21,10 +23,10 @@ class OnboardingProfileSettingActivity : initBindingViewModel() initOnLineInfoEditorActionListener() - initSetOnFucusChangeListener() + initSetOnFocusChangeListener() + observeIsNameAvailable() observeIsProfileAvailable() observeTextLength() - observeIsNameAvailable() } private fun initBindingViewModel() { @@ -38,29 +40,71 @@ class OnboardingProfileSettingActivity : } } - private fun initSetOnFucusChangeListener() { + private fun initSetOnFocusChangeListener() { binding.etOnboardingProfileSettingName.setOnFocusChangeListener { _, hasFocus -> - judgeCounterColorWithFocus(hasFocus) + setColors( + hasFocus, + viewModel.nowNameLength.value ?: 0, + binding.tvNameCounter, + ) { background -> + binding.etOnboardingProfileSettingName.background = ResourcesCompat.getDrawable( + this.resources, + background, + theme, + ) + } } binding.etOnboardingProfileSettingInfo.setOnFocusChangeListener { _, hasFocus -> - judgeCounterColorWithFocus(hasFocus) + setColors( + hasFocus, + viewModel.nowInfoLength.value ?: 0, + binding.tvInfoCounter, + ) { background -> + binding.etOnboardingProfileSettingInfo.background = ResourcesCompat.getDrawable( + this.resources, + background, + theme, + ) + } } } - private fun judgeCounterColorWithFocus(hasFocus: Boolean) { - if (hasFocus) { - setNameCounterColor(R.color.gray_700) - } else { - setNameCounterColor(R.color.gray_200) + private fun observeIsNameAvailable() { + viewModel.isNameAvailable.observe(this) { state -> + setColors( + false, + viewModel.nowNameLength.value ?: 0, + binding.tvNameCounter, + ) { background -> + binding.etOnboardingProfileSettingName.background = ResourcesCompat.getDrawable( + this.resources, + background, + theme, + ) + } } - if (viewModel.isNameAvailable.value == NameState.Blank) { - setNameCounterColor(R.color.red_500) + } + + private fun setColors( + hasFocus: Boolean, + length: Int, + counter: TextView, + 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 } + + setCounterColor(counter, color) + setBackground(background) } - private fun setNameCounterColor(color: Int) { - binding.tvNameCounter.setTextColor(getColor(color)) + private fun setCounterColor(counter: TextView, color: Int) { + counter.setTextColor(getColor(color)) } private fun observeIsProfileAvailable() { @@ -94,15 +138,6 @@ class OnboardingProfileSettingActivity : } } - private fun observeIsNameAvailable() { - viewModel.isNameAvailable.observe(this) { state -> - when (state) { - NameState.Blank -> binding.tvNameCounter.setTextColor(getColor(R.color.red_500)) - else -> binding.tvNameCounter.setTextColor(getColor(R.color.gray_700)) - } - } - } - private fun moveSplash() { // 스플래시로 이동 } diff --git a/presentation/src/main/java/com/going/presentation/tendencytest/TendencyTestActivity.kt b/presentation/src/main/java/com/going/presentation/tendencytest/TendencyTestActivity.kt new file mode 100644 index 00000000..0686414d --- /dev/null +++ b/presentation/src/main/java/com/going/presentation/tendencytest/TendencyTestActivity.kt @@ -0,0 +1,22 @@ +package com.going.presentation.tendencytest + +import android.os.Bundle +import com.going.presentation.R +import com.going.presentation.databinding.ActivityTendencyTestSplashBinding +import com.going.ui.base.BaseActivity +import com.going.ui.extension.setOnSingleClickListener + +class TendencyTestActivity : + BaseActivity(R.layout.activity_tendency_test_splash) { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + initStartBtnSingleClickListener() + } + + private fun initStartBtnSingleClickListener() { + binding.btnTendencySplashStart.setOnSingleClickListener { + // 페이지 이동~ + } + } +} diff --git a/presentation/src/main/res/drawable/sel_rounded_corner_edit_text.xml b/presentation/src/main/res/drawable/sel_rounded_corner_edit_text.xml index ab546cbf..cbe3888c 100644 --- a/presentation/src/main/res/drawable/sel_rounded_corner_edit_text.xml +++ b/presentation/src/main/res/drawable/sel_rounded_corner_edit_text.xml @@ -1,15 +1,8 @@ - + - - - - - - - - + diff --git a/presentation/src/main/res/drawable/sel_rounded_corner_edit_text_empty.xml b/presentation/src/main/res/drawable/sel_rounded_corner_edit_text_empty.xml new file mode 100644 index 00000000..0c2bf580 --- /dev/null +++ b/presentation/src/main/res/drawable/sel_rounded_corner_edit_text_empty.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/presentation/src/main/res/drawable/sel_rounded_corner_edit_text_error.xml b/presentation/src/main/res/drawable/sel_rounded_corner_edit_text_error.xml index 524ea68e..f8a3f0b8 100644 --- a/presentation/src/main/res/drawable/sel_rounded_corner_edit_text_error.xml +++ b/presentation/src/main/res/drawable/sel_rounded_corner_edit_text_error.xml @@ -1,8 +1,8 @@ - + - + diff --git a/presentation/src/main/res/layout/activity_onboarding_profile_setting.xml b/presentation/src/main/res/layout/activity_onboarding_profile_setting.xml index 05daae16..42a98600 100644 --- a/presentation/src/main/res/layout/activity_onboarding_profile_setting.xml +++ b/presentation/src/main/res/layout/activity_onboarding_profile_setting.xml @@ -46,7 +46,7 @@ android:layout_marginHorizontal="24dp" android:layout_marginTop="6dp" android:afterTextChanged="@{(text) -> viewModel.checkProfileAvailable()}" - android:background="@{viewModel.isNameAvailable() == NameState.Blank ? @drawable/sel_rounded_corner_edit_text_error : @drawable/sel_rounded_corner_edit_text}" + android:background="@drawable/sel_rounded_corner_edit_text_empty" android:hint="@string/onboarding_et_name_hint" android:imeOptions="actionNext" android:inputType="text" @@ -95,7 +95,7 @@ android:layout_marginHorizontal="24dp" android:layout_marginTop="6dp" android:afterTextChanged="@{(text) -> viewModel.checkProfileAvailable()}" - android:background="@drawable/sel_rounded_corner_edit_text" + android:background="@drawable/sel_rounded_corner_edit_text_empty" android:hint="@string/onboarding_one_line_et_info" android:imeOptions="actionDone" android:inputType="text" @@ -106,9 +106,11 @@ app:layout_constraintTop_toBottomOf="@id/tv_onboarding_profile_setting_on_line_info_title" /> diff --git a/presentation/src/main/res/layout/activity_tendency_test_splash.xml b/presentation/src/main/res/layout/activity_tendency_test_splash.xml new file mode 100644 index 00000000..40d7cdb7 --- /dev/null +++ b/presentation/src/main/res/layout/activity_tendency_test_splash.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 03cffe25..56b9abeb 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -22,4 +22,8 @@ 당신을 한줄로 표현해보세요 유형 검사하러 가기 + + 9개의 질문으로\n여행 성향을 분석해보세요 + 시작하기 + diff --git a/presentation/src/main/res/values/themes.xml b/presentation/src/main/res/values/themes.xml index 5afe8ffa..7881fa21 100644 --- a/presentation/src/main/res/values/themes.xml +++ b/presentation/src/main/res/values/themes.xml @@ -25,7 +25,7 @@