Skip to content

[Feature/hi/timer] 게임 중 화면에서 타이머 카운트 다운 구현하기#21

Draft
HI-JIN2 wants to merge 6 commits intodevelopfrom
feature/hi/timer
Draft

[Feature/hi/timer] 게임 중 화면에서 타이머 카운트 다운 구현하기#21
HI-JIN2 wants to merge 6 commits intodevelopfrom
feature/hi/timer

Conversation

@HI-JIN2
Copy link
Collaborator

@HI-JIN2 HI-JIN2 commented Mar 7, 2024

Summary

시간 카운트 다운 구현 중

Describe your changes

  • 분,:,초 세 개로 나눠있던 Text를 하나로 합쳤습니다.
  • xml의 data varibale에 두 개의 뷰모델을 등록해는데, 이게 가능한 방법인지는 모르겠습니다.
  • Flow는 cold stream이기 때문에 observable한 형태는 불가능해서 SharedFlow와 emit으로 시간 카운트 다운을 뷰에 전달 하려고 하는데, 생각외로 잘 안되네요..! suspend를 잘못사용하고 있다는 생각이 들기도 합니다.. 일단 Draft로 올려놓고, 해당 부분을 조금 더 공부해보겠습니다.

Issue

#18

To reviewers

위에 기재해놓았습니다. :-)

@HI-JIN2 HI-JIN2 requested review from a team and kangyuri1114 March 7, 2024 06:44
@HI-JIN2 HI-JIN2 self-assigned this Mar 7, 2024
@HI-JIN2 HI-JIN2 changed the title [Feature/hi/timer] [Feature/hi/timer] 게임 중 화면에서 타이머 카운트 다운 구현하기 Mar 7, 2024
val mHandler = Handler(Looper.getMainLooper())

mHandler.postDelayed({
suspend {

Choose a reason for hiding this comment

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

suspend 키워드는 없어도 될 것 같습니다!

이렇게 해두면 함수 정의만 하고 실행을 안 한 거랑 같아서 실행이 안 될거예요

}

mainViewModel.formattedTime
.buffer()

Choose a reason for hiding this comment

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

buffer() 가 어떤 역할을 하는 함수인가요? 그리고 추가하신 이유가 있을까요?

.collect { formattedTime ->
Log.d("play", formattedTime)
// UI 업데이트
binding.tvPlayTime.text = formattedTime

Choose a reason for hiding this comment

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

단순히 텍스트 갱신만 한다면 데이터 바인딩으로도 가능할 것 같습니다!


}
}, 0)
suspend {

Choose a reason for hiding this comment

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

여기도 마찬가지네욥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants