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

[feat/onboarding_view]: 온보딩 UI 작업, 뷰 연결 #56

Merged
merged 112 commits into from
Jan 9, 2024

Conversation

kangyuri1114
Copy link
Member

@kangyuri1114 kangyuri1114 commented Jan 8, 2024

개요

작업 사항

  • 온보딩 UI 작업
  • 온보딩 프래그먼트, 액티비티 연결

변경 사항(optional)

  • 기존 onboarding -> onBoarding으로 명명 변경
  • 회원가입 완료 뷰 프래그먼트 -> 액티비티로 변경
  • 화면 설계 시 논의한 부분들 반영 화면 설계
  • 디자인 시스템 미반영 (글씨, 컬러는 아직 구현하지 않음)

논의 필요한 부분

  • 프래그먼트 스택 관리(뒤로 가기 구현 시)
  • UI 구현 시 변수명, 파일명 컨벤션 확인, 레이아웃 구조 확인

스크린샷(optional)

기본 기능 구현만 진행했고, pr 확인 후 코드, 파일 구조 디벨롭 진행할 예정입니다.
https://github.com/Team-HMH/HMH-Android/assets/83583757/38b382f4-2c6c-4421-80f4-03767ad61e94

kangyuri1114 and others added 30 commits January 3, 2024 20:41
@kangyuri1114 kangyuri1114 added 💻feat 새로운 기능 추가 🐰유리 유리 작업 labels Jan 8, 2024
@kangyuri1114 kangyuri1114 self-assigned this Jan 8, 2024
@kangyuri1114 kangyuri1114 requested a review from a team as a code owner January 8, 2024 11:34
kangyuri1114 and others added 4 commits January 8, 2024 20:50
# Conflicts:
#	app/src/main/java/com/hmh/hamyeonham/SampleActivity.kt
#	feature/onboarding/build.gradle.kts
#	feature/onboarding/src/main/AndroidManifest.xml
#	feature/onboarding/src/main/java/com/hmh/hamyeonham/feature/onboarding/OnBoardingAccessibilityService.kt
#	feature/onboarding/src/main/java/com/hmh/hamyeonham/feature/onboarding/OnBoardingActivity.kt
#	feature/onboarding/src/main/res/layout/activity_on_boarding.xml
Copy link
Member

@kez-lab kez-lab left a comment

Choose a reason for hiding this comment

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

코멘트 확인해주시고 일단 클릭시 기능 구현을 완료한 코드까지 올려주시면 감사하겠습니다~!

Comment on lines 27 to 52
OnBoardingFragmentType.SELECT_DATA_TIME -> OnBoardingSelectDataFragment.newInstance(
OnBoardingQuestionList.OnBoardingQuestionTime[0],
OnBoardingQuestionList.OnBoardingQuestionTime[1],
OnBoardingQuestionList.OnBoardingQuestionTime[2],
OnBoardingQuestionList.OnBoardingQuestionTime[3],
OnBoardingQuestionList.OnBoardingQuestionTime[4],
OnBoardingQuestionList.OnBoardingQuestionTime[5],
)

OnBoardingFragmentType.SELECT_DATA_PROBLEM -> OnBoardingSelectDataFragment.newInstance(
OnBoardingQuestionList.OnBoardingQuestionProblem[0],
OnBoardingQuestionList.OnBoardingQuestionProblem[1],
OnBoardingQuestionList.OnBoardingQuestionProblem[2],
OnBoardingQuestionList.OnBoardingQuestionProblem[3],
OnBoardingQuestionList.OnBoardingQuestionProblem[4],
OnBoardingQuestionList.OnBoardingQuestionProblem[5],
)

OnBoardingFragmentType.SELECT_DATA_PERIOD -> OnBoardingSelectDataFragment.newInstance(
OnBoardingQuestionList.OnBoardingChallengePeriod[0],
OnBoardingQuestionList.OnBoardingChallengePeriod[1],
OnBoardingQuestionList.OnBoardingChallengePeriod[2],
OnBoardingQuestionList.OnBoardingChallengePeriod[3],
OnBoardingQuestionList.OnBoardingChallengePeriod[4],
OnBoardingQuestionList.OnBoardingChallengePeriod[5],
)
Copy link
Member

Choose a reason for hiding this comment

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

여기 싱글톤 리스트 관리가 아닌 dataclass로 객체 생성해서 주입받는 방식을 사용해보면 좋을 것 같습니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

어댑터 내에 enum class로 각 프래그먼트 타입 생성된 것으로 수정 되었습니다~!

Comment on lines 9 to 24
var onBoardingFragments: ArrayList<Fragment> = ArrayList()
override fun getItemCount(): Int {
return onBoardingFragments.size
}

override fun createFragment(position: Int): Fragment {
return onBoardingFragments[position]
}

fun removeOnboardingFragments() {
onBoardingFragments.removeLast()
}

fun addOnboardingFragment(fragmentType: OnBoardingFragmentType) {
val fragment = when (fragmentType) {
OnBoardingFragmentType.REQUEST_PERMISSION -> OnBoardingRequestPermissionFragment()
Copy link
Member

Choose a reason for hiding this comment

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

Enum classd, when문으로 관리해보면 좋을 것 같습니다.

Comment on lines 55 to 60
val question = requireArguments().getString(ARG_QUESTION)
val description = requireArguments().getString(ARG_DESCRIPTION)
val btn1 = requireArguments().getString(ARG_BTN1)
val btn2 = requireArguments().getString(ARG_BTN2)
val btn3 = requireArguments().getString(ARG_BTN3)
val btn4 = requireArguments().getString(ARG_BTN4)
Copy link
Member

Choose a reason for hiding this comment

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

스코프함수 활용 ㄱㄱ

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
val question = requireArguments().getString(ARG_QUESTION)
val description = requireArguments().getString(ARG_DESCRIPTION)
val btn1 = requireArguments().getString(ARG_BTN1)
val btn2 = requireArguments().getString(ARG_BTN2)
val btn3 = requireArguments().getString(ARG_BTN3)
val btn4 = requireArguments().getString(ARG_BTN4)
requireArguments().run {
val question = getString(ARG_QUESTION)
val description = getString(ARG_DESCRIPTION)
val btn1 = getString(ARG_BTN1)
val btn2 = getString(ARG_BTN2)
val btn3 = getString(ARG_BTN3)
val btn4 = getString(ARG_BTN4)
}

Comment on lines 25 to 38
private fun setOnboardingViewPager(pagerAdapter: OnBoardingFragmentStateAdapter) {
val currentItem = binding.vpOnboardingContainer.currentItem
if (currentItem < pagerAdapter.itemCount - 1) {
binding.vpOnboardingContainer.currentItem = currentItem + 1
}
if (currentItem == pagerAdapter.itemCount - 1) {
pagerAdapter.removeOnboardingFragments()
startActivity(
Intent(this, OnBoardingDoneSingUpActivity::class.java).addFlags(
FLAG_ACTIVITY_NO_ANIMATION,
),
)
}
}
Copy link
Member

@kez-lab kez-lab Jan 8, 2024

Choose a reason for hiding this comment

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

  1. pagerAdapter.removeOnboardingFragments() 없애야할 것 같습니다
  2. startActivity 한 후에 finish
  3. agerAdapter.itemCount - 1 대신 조금 더 안전한 방법이 필요해요

Comment on lines 24 to 28

binding.run {
npOnboardingScreentimeGoal.minValue = 1
npOnboardingScreentimeGoal.maxValue = 6
}
Copy link
Member

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.

확장함수로 추출했고, common 모듈에 NumberPickerExt 파일 만들어두었습니다!

Comment on lines 25 to 30
binding.run {
npOnboardingUseTimeGoalHour.minValue = 1
npOnboardingUseTimeGoalHour.maxValue = 6
npOnboardingUseTimeGoalMinute.minValue = 0
npOnboardingUseTimeGoalMinute.maxValue = 59
}
Copy link
Member

@kez-lab kez-lab Jan 8, 2024

Choose a reason for hiding this comment

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

fun NumberPicker.setRangeTime(minValue: Int, maxValue: Int) {
minValue = minValue
maxValue ] maxValue
}

Comment on lines +45 to +48


<TextView
android:id="@+id/tv_onboarding_done_sing_up_description"
Copy link
Member

Choose a reason for hiding this comment

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

줄바꿈 고쳐주세요

Comment on lines 49 to 54
private fun initFragmentType() {
val args = requireArguments().getString(ARG_FRAGMENT_TYPE)?.toOnboardingFragmentType()
if (args != null) {
viewModel.initQuestionData(args)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

요기 이름 변경이 필요해보입니당

Comment on lines +56 to +67
private fun initViews() {
viewModel.onBoardingSelectDataState.onEach {
binding.apply {
val onBoardingQuestion = it.onBoardingQuestion
tvOnboardingSelectDataQuestion.text = onBoardingQuestion.title
tvOnboardingSelectDataDescription.text = onBoardingQuestion.description
btnOnboardingSelectData1.text = onBoardingQuestion.options.getOrNull(0).orEmpty()
btnOnboardingSelectData2.text = onBoardingQuestion.options.getOrNull(1).orEmpty()
btnOnboardingSelectData3.text = onBoardingQuestion.options.getOrNull(2).orEmpty()
btnOnboardingSelectData4.text = onBoardingQuestion.options.getOrNull(3).orEmpty()
}
}.launchIn(lifecycleScope)
Copy link
Member

Choose a reason for hiding this comment

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

2차 릴리즈에서는 id에 숫자를 붙이지 않는 방법도 있을지 고려해보면 좋을 것 같긴합니다

Copy link
Member Author

Choose a reason for hiding this comment

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

넵 기록해두겠습니다!

Comment on lines +20 to +37
fun initQuestionData(fragmentType: OnBoardingFragmentType) {
val onBoardingQuestionTime = OnBoardingQuestion(
"하루 평균 휴대폰을\n얼마나 사용하시나요?",
"",
listOf("1-4시간", "4-8시간", "8-12시간", "12시간 이상")
)

val onBoardingQuestionProblem = OnBoardingQuestion(
"휴대폰을 사용할 때\n어떤 문제를 겪고 계시나요?",
"해당 문항은 최대 2개의 복수 응답이 가능해요",
listOf("중독이 너무 심해요", "무의식적으로 사용하게 돼요", "스스로 제어가 안돼요", "일상생활에 영향을 끼쳐요")
)

val onBoardingChallengePeriod = OnBoardingQuestion(
"챌린지 기간을 선택해주세요",
"첫 챌린지로 가볍게 도전하기 좋은 7일을 추천해요!",
listOf("7일", "14일", "21일", "30일")
)
Copy link
Member

Choose a reason for hiding this comment

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

2차에서는 요 아이들을 어떻게 관리할지도 확인해봐야할 것 같습니다

Copy link
Member Author

Choose a reason for hiding this comment

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

서버로 부터 문항 불러오는 것 2차 논의 사항인데 이것도 기록해두겠습니다.

Copy link
Member

@kez-lab kez-lab left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~!!

@kez-lab kez-lab merged commit 4b1ad31 into develop Jan 9, 2024
1 check passed
@kez-lab kez-lab deleted the feat/onboarding_view branch January 9, 2024 15:12
@jihyun0v0 jihyun0v0 changed the title [feat/onboarding view]: 온보딩 UI 작업, 뷰 연결 [feat/onboarding_view]: 온보딩 UI 작업, 뷰 연결 Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐰유리 유리 작업 💻feat 새로운 기능 추가
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[feat] : 온보딩 화면 구현 UI, 전체 뷰
2 participants