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

Design : 온보딩 화면 QA 적용 #222

Merged
merged 38 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6f4e9ac
fix : 키워드 선택 화면 가운데 정렬 화면 깨짐 수정
huiwoo-jo Mar 30, 2024
f03812a
design : 비활성 온보딩 스텝 투명화
huiwoo-jo Mar 30, 2024
4240cec
design : 온보딩 스텝 폭 고정
huiwoo-jo Mar 30, 2024
29ae805
design : 온보딩 스텝 margin 조정
huiwoo-jo Mar 30, 2024
8890d14
design : 온보딩 스텝 가로폭 조정
huiwoo-jo Mar 30, 2024
bc39891
refactor : setSpanText의 baseContext제거
huiwoo-jo Mar 30, 2024
74cd243
refactor : 키워드 선택 -> 키워드 설정
huiwoo-jo Mar 30, 2024
66575a6
design : color값 변경 main -> blue300
huiwoo-jo Mar 30, 2024
6dcdbdc
design : 키워드 선택 chip 크기 및 테두리
huiwoo-jo Mar 30, 2024
29b0fea
design : 키워드 뷰들 선택 간격 조정
huiwoo-jo Mar 30, 2024
23e7758
design : 스크롤 뷰를 위한 constraint 제약
huiwoo-jo Mar 30, 2024
78dc699
style : 자동 정렬
huiwoo-jo Mar 30, 2024
daec01d
refactor : 학과 선택 시 검색 창 색상 변경 및 버튼 활성화
huiwoo-jo Mar 30, 2024
135ff98
feat : 온보딩 키워드 하나 이상 선택 필수
huiwoo-jo Mar 30, 2024
1a697fc
feat : 학과 필수 선택
huiwoo-jo Mar 30, 2024
9e1475f
fix : 빈 아이템 선택시 어플 종료 오류
huiwoo-jo Mar 30, 2024
b7d1d4a
style : 자동 정렬 및 공백 제거
huiwoo-jo Mar 30, 2024
1ddf9e0
feat : 키워드 설정 하나 이상 필수 선택
huiwoo-jo Mar 30, 2024
a268371
design : 설정 화면 내 키워드 선택 화면 리디자인
huiwoo-jo Apr 1, 2024
04f6fda
design : 온보딩 제목 사이 마진
huiwoo-jo Apr 1, 2024
25091a1
rename : drawable 이름 변경 및 수정
huiwoo-jo Apr 1, 2024
c2f1fee
rename : 색상 blue -> gray
huiwoo-jo Apr 1, 2024
830ebf1
refactor : 검색창 및 확인 버튼 색상 적용
huiwoo-jo Apr 1, 2024
52f7391
refactor : 키워드 선택 하단 버튼 색상 변경
huiwoo-jo Apr 1, 2024
38b8239
design : chip stroke 추가 및 수정
huiwoo-jo Apr 1, 2024
f72a978
design : 키워드 알림 설정 스위치 크기 및 텍스트 변경
huiwoo-jo Apr 1, 2024
881bb60
design : gray300 값 수정
huiwoo-jo Apr 1, 2024
8f2fb4b
refactor : 키워드 화면 내 온보딩 아이디 오류 수정
huiwoo-jo Apr 1, 2024
fc1b1a6
fix : 키워드 첫 화면 감지 제거
huiwoo-jo Apr 1, 2024
66fa7ef
refactor : 학과선택 padding값 수정
huiwoo-jo Apr 1, 2024
cb28e0f
refactor : 테두리 굵기 변경
huiwoo-jo Apr 1, 2024
a7fafb2
refactor : 온보딩 학과선택 폰트 수정
huiwoo-jo Apr 1, 2024
a6abd27
refactor : 온보딩 확인 버튼 폰트 수정
huiwoo-jo Apr 1, 2024
93b2e91
design : gray 설정 값 수정
huiwoo-jo Apr 2, 2024
740a5a0
design : line 색상 값 수정
huiwoo-jo Apr 2, 2024
4651e66
refactor : 식단화면 gray 색상 변경
huiwoo-jo Apr 2, 2024
d49fd68
refactor : constraint 제약 id 수정
huiwoo-jo Apr 2, 2024
4aed772
design : 온보딩 학과 검색창 색상 지정
huiwoo-jo Apr 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class DepartRepository {
SharedPreference.setCode(department.code)
}

fun getIsFirstLaunch(): Boolean = SharedPreference.getIsFirstLaunch()

fun getUserDepartment(): String {
return SharedPreference.getDepartment()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ abstract class BaseActivity<T : ViewDataBinding, R : BaseViewModel> : AppCompatA
}

protected fun setSpanText(
baseContext: Context,
spanTextView: TextView,
startIdx: Int,
endIdx: Int
) {
SpannableStringBuilder(spanTextView.text).apply {
setSpan(
ForegroundColorSpan(getColor(com.dongyang.android.youdongknowme.R.color.main)),
ForegroundColorSpan(getColor(com.dongyang.android.youdongknowme.R.color.blue300)),
startIdx,
endIdx,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.recyclerview.widget.RecyclerView
import com.dongyang.android.youdongknowme.databinding.ItemOnboardingDepartBinding
import com.dongyang.android.youdongknowme.ui.view.depart.DepartClickListener


class OnboardingDepartAdapter : RecyclerView.Adapter<OnboardingDepartAdapter.ViewHolder>() {

private val item = ArrayList<String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class DepartViewModel(private val departRepository: DepartRepository) : BaseView

private val _selectDepartPosition = MutableLiveData(-1)
val selectDepartPosition: LiveData<Int> get() = _selectDepartPosition

init {
getUserDepartment()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ package com.dongyang.android.youdongknowme.ui.view.depart

import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.text.Editable
import android.text.TextWatcher
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.dongyang.android.youdongknowme.R
import com.dongyang.android.youdongknowme.databinding.ActivityOnboardingDepartBinding
import com.dongyang.android.youdongknowme.standard.base.BaseActivity
import com.dongyang.android.youdongknowme.ui.adapter.OnboardingDepartAdapter
import com.dongyang.android.youdongknowme.ui.view.keyword.OnboardingKeywordActivity
import com.dongyang.android.youdongknowme.ui.view.main.MainActivity
import org.koin.androidx.viewmodel.ext.android.viewModel


class OnboardingDepartActivity : BaseActivity<ActivityOnboardingDepartBinding, DepartViewModel>(),
DepartClickListener {

Expand Down Expand Up @@ -42,18 +43,20 @@ class OnboardingDepartActivity : BaseActivity<ActivityOnboardingDepartBinding, D
}

// 부분 색상 지정
setSpanText(baseContext, binding.tvOnboardingDepartTitleMain, startIdx = 0, endIdx = 5)
setSpanText(binding.tvOnboardingDepartTitleMain, startIdx = 0, endIdx = 5)
}

override fun initDataBinding() = Unit

override fun initAfterBinding() {
binding.ibOnboardingDepartSearchClear.setOnClickListener {
binding.etOnboardingDepartSearch.text.clear()
setSearchColor(false)
}

binding.etOnboardingDepartSearch.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(charSequence: CharSequence?, i: Int, i1: Int, i2: Int) = Unit
override fun beforeTextChanged(charSequence: CharSequence?, i: Int, i1: Int, i2: Int) =
Unit

override fun onTextChanged(charSequence: CharSequence?, i: Int, i1: Int, i2: Int) = Unit

Expand All @@ -69,6 +72,12 @@ class OnboardingDepartActivity : BaseActivity<ActivityOnboardingDepartBinding, D
for (item in items) {
if (item.contains(searchText)) {
searchList.add(item)

if (item == searchText) {
setSearchColor(true)
} else {
setSearchColor(false)
}
}
}
adapter.submitList(searchList)
Expand All @@ -80,27 +89,75 @@ class OnboardingDepartActivity : BaseActivity<ActivityOnboardingDepartBinding, D
adapter.submitPosition(it)

if (it != -1) {
getDepart(searchList)
binding.etOnboardingDepartSearch.setText(
searchList[viewModel.selectDepartPosition.value ?: 0]
)
binding.etOnboardingDepartSearch.setSelection(binding.etOnboardingDepartSearch.text.length)
}
}

binding.btnOnboardingDepartNext.setOnClickListener {
getDepart(searchList)
}
}

private fun setSearchColor(isContains: Boolean) {
if (isContains) {
binding.linearLayoutOnboardingDepartSearch.setBackgroundResource(R.drawable.bg_stroke_blue300_radius_2dp)
binding.etOnboardingDepartSearch.setTextColor(getColor(R.color.blue300))
binding.etOnboardingDepartSearch.compoundDrawableTintList =
ColorStateList.valueOf(
ContextCompat.getColor(
this@OnboardingDepartActivity,
R.color.blue300
)
)
binding.btnOnboardingDepartNext.backgroundTintList =
ColorStateList.valueOf(
ContextCompat.getColor(
this@OnboardingDepartActivity,
R.color.blue300
)
)
} else {
viewModel.setSelectPosition(-1)

binding.linearLayoutOnboardingDepartSearch.setBackgroundResource(R.drawable.bg_stroke_gray300_radius_2dp)
binding.etOnboardingDepartSearch.setTextColor(getColor(R.color.gray300))
binding.etOnboardingDepartSearch.compoundDrawableTintList =
ColorStateList.valueOf(
ContextCompat.getColor(
this@OnboardingDepartActivity,
R.color.gray300
)
)
binding.btnOnboardingDepartNext.backgroundTintList =
ColorStateList.valueOf(
ContextCompat.getColor(
this@OnboardingDepartActivity,
R.color.gray300
)
)
}
}

// 컨테이너 클릭 시 선택한 학과의 포지션 저장
override fun containerClick(position: Int) {
if (searchList.isEmpty()) {
return
}
viewModel.setSelectPosition(position)
}

// 확인 버튼을 누르면 내부 DB에 학과를 담고 메인 액티비티로 이동
private fun getDepart(items: ArrayList<String>) {
return binding.btnOnboardingDepartNext.setOnClickListener {
if (viewModel.selectDepartPosition.value != -1) {
viewModel.setDepartment(items[viewModel.selectDepartPosition.value ?: 0])
val intent = Intent(this, OnboardingKeywordActivity::class.java)
startActivity(intent)
finish()
} else {
Toast.makeText(this, R.string.toast_msg_department, Toast.LENGTH_SHORT).show()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package com.dongyang.android.youdongknowme.ui.view.keyword

import android.content.Intent
import android.content.res.ColorStateList
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer
import com.dongyang.android.youdongknowme.R
import com.dongyang.android.youdongknowme.data.local.entity.KeywordEntity
import com.dongyang.android.youdongknowme.databinding.ActivityKeywordBinding
import com.dongyang.android.youdongknowme.standard.base.BaseActivity
import com.dongyang.android.youdongknowme.ui.view.setting.OnboardingPermissionActivity
import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup
import org.koin.androidx.viewmodel.ext.android.viewModel
Expand Down Expand Up @@ -32,6 +37,26 @@ class KeywordActivity : BaseActivity<ActivityKeywordBinding, KeywordViewModel>()
viewModel.localKeywordList.removeObserver(this)
}
})

viewModel.checkKeywordList.observe(this) { checkedKeywords ->
if (checkedKeywords.isEmpty()) {
binding.btnKeywordComplete.backgroundTintList =
ColorStateList.valueOf(
ContextCompat.getColor(
this@KeywordActivity,
R.color.gray300
)
)
} else {
binding.btnKeywordComplete.backgroundTintList =
ColorStateList.valueOf(
ContextCompat.getColor(
this@KeywordActivity,
R.color.blue300
)
)
}
}
}

override fun initAfterBinding() {
Expand All @@ -40,7 +65,19 @@ class KeywordActivity : BaseActivity<ActivityKeywordBinding, KeywordViewModel>()
binding.btnKeywordComplete.setOnClickListener {
viewModel.subscribeCheckedKeyword()
setResult(RESULT_OK)
finish()

if (viewModel.checkKeywordList.value?.isNotEmpty() == true) {
viewModel.subscribeCheckedKeyword()

val intent = Intent(
this@KeywordActivity,
OnboardingPermissionActivity::class.java
)
startActivity(intent)
finish()
} else {
Toast.makeText(this, R.string.toast_msg_keyword, Toast.LENGTH_SHORT).show()
}
}

binding.toolbarKeyword.btnToolbarExit.setOnClickListener { finish() }
Expand All @@ -52,7 +89,7 @@ class KeywordActivity : BaseActivity<ActivityKeywordBinding, KeywordViewModel>()
val chip: Chip = chipGroup.getChildAt(index) as Chip

// 유저가 선택 및 설정한 키워드인 경우 체크한 것으로 설정
if (chip.text in viewModel.checkKeywordList) {
if (viewModel.checkKeywordList.value?.contains(chip.text) == true) {
chip.isChecked = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class KeywordViewModel(
private val _localKeywordList: MutableLiveData<List<KeywordEntity>> = MutableLiveData()
val localKeywordList: LiveData<List<KeywordEntity>> get() = _localKeywordList

private val _checkKeywordList = mutableSetOf<String>()
val checkKeywordList get() = _checkKeywordList
private val _checkKeywordList = MutableLiveData<Set<String>>(mutableSetOf())
val checkKeywordList: LiveData<Set<String>> get() = _checkKeywordList

fun getLocalKeywordList() {
viewModelScope.launch {
Expand All @@ -31,7 +31,7 @@ class KeywordViewModel(

fun subscribeCheckedKeyword() {
for (localKeyword in localKeywordList.value ?: emptyList()) {
if (checkKeywordList.contains(localKeyword.name)) {
if (checkKeywordList.value?.contains(localKeyword.name) == true) {
// 선택했던 데이터를 중첩해서 바꾸면 효율성이 떨어지고, 파이어베이스 구독에 문제가 생길 수 있으므로 구독 여부도 함께 체크
if (!localKeyword.isSubscribe) {
viewModelScope.launch {
Expand All @@ -51,14 +51,14 @@ class KeywordViewModel(
}

fun setAllKeywords(keyword: List<String>) {
_checkKeywordList.addAll(keyword)
_checkKeywordList.value = keyword.toSet()
}

fun setCheckedKeywords(keyword: String) {
_checkKeywordList.add(keyword)
_checkKeywordList.value = _checkKeywordList.value?.plus(keyword) ?: setOf(keyword)
}

fun removeCheckedKeywords(keyword: String) {
_checkKeywordList.remove(keyword)
_checkKeywordList.value = _checkKeywordList.value?.minus(keyword) ?: setOf()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.dongyang.android.youdongknowme.ui.view.keyword

import android.content.Intent
import android.content.res.ColorStateList
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer
import com.dongyang.android.youdongknowme.R
import com.dongyang.android.youdongknowme.data.local.entity.KeywordEntity
Expand All @@ -19,7 +22,7 @@ class OnboardingKeywordActivity :

override fun initStartView() {
// 부분 색상 지정
setSpanText(this, binding.tvOnboardingKeywordTitleMain, startIdx = 0, endIdx = 3)
setSpanText(binding.tvOnboardingKeywordTitleMain, startIdx = 0, endIdx = 3)
}

override fun initDataBinding() {
Expand All @@ -38,18 +41,45 @@ class OnboardingKeywordActivity :
viewModel.localKeywordList.removeObserver(this)
}
})

viewModel.checkKeywordList.observe(this) { checkedKeywords ->
if (checkedKeywords.isEmpty()) {
binding.btnOnboardingKeywordNext.backgroundTintList =
ColorStateList.valueOf(
ContextCompat.getColor(
this@OnboardingKeywordActivity,
R.color.gray300
)
)
} else {
binding.btnOnboardingKeywordNext.backgroundTintList =
ColorStateList.valueOf(
ContextCompat.getColor(
this@OnboardingKeywordActivity,
R.color.blue300
)
)
}
}
}

override fun initAfterBinding() {
viewModel.getLocalKeywordList()

// TODO :: 안드로이드 데이터베이스에 유저별 설정한 키워드 저장 및 파이어베이스 키워드 구독 설정
binding.btnOnboardingKeywordNext.setOnClickListener {
viewModel.subscribeCheckedKeyword()
val intent =
Intent(this@OnboardingKeywordActivity, OnboardingPermissionActivity::class.java)
startActivity(intent)
finish()
if (viewModel.checkKeywordList.value?.isNotEmpty() == true) {
viewModel.subscribeCheckedKeyword()
val intent = Intent(
this@OnboardingKeywordActivity,
OnboardingPermissionActivity::class.java
)
startActivity(intent)
finish()
} else {
Toast.makeText(this, R.string.toast_msg_keyword, Toast.LENGTH_SHORT).show()
}

}
}

Expand All @@ -60,7 +90,7 @@ class OnboardingKeywordActivity :
val chip: Chip = chipGroup.getChildAt(index) as Chip

// 유저가 선택 및 설정한 키워드인 경우 체크한 것으로 설정
if (chip.text in viewModel.checkKeywordList) {
if (viewModel.checkKeywordList.value?.contains(chip.text) == true) {
chip.isChecked = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OnboardingPermissionActivity :
viewModel.getUserDepartment()
setPermissionSwitch(false)

setSpanText(this, binding.tvPermissionTitleMain, startIdx = 0, endIdx = 9)
setSpanText(binding.tvPermissionTitleMain, startIdx = 0, endIdx = 9)
}

override fun initDataBinding() = Unit
Expand Down Expand Up @@ -66,7 +66,7 @@ class OnboardingPermissionActivity :
val resources = if (isChecked) {
R.color.blue300
} else {
R.color.gray300
R.color.gray400
}

binding.switchPermission.compoundDrawableTintList =
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/color/bg_chip_stroke_select.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:color="@color/blue300" />
<item android:state_checked="false"
android:color="@color/gray400" />
</selector>
Loading
Loading