Skip to content

[정현수_Android] 8주차 과제 제출#9

Open
Rickettsia1234 wants to merge 2 commits into
BCSDLab-Edu:mainfrom
Rickettsia1234:week8
Open

[정현수_Android] 8주차 과제 제출#9
Rickettsia1234 wants to merge 2 commits into
BCSDLab-Edu:mainfrom
Rickettsia1234:week8

Conversation

@Rickettsia1234

Copy link
Copy Markdown

No description provided.

@JaeYoung290 JaeYoung290 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

수고 많으셨습니다!

Comment on lines +100 to +114
private fun getFormattedTime(): String {
val m = (timeCentiseconds / 6000).toString().padStart(2, '0')
val s = ((timeCentiseconds % 6000) / 100).toString().padStart(2, '0')
val ms = (timeCentiseconds % 100).toString().padStart(2, '0')

return "$m:$s:$ms"
}

private fun updateTimerText() {
val m = (timeCentiseconds / 6000).toString().padStart(2, '0')
val s = ((timeCentiseconds % 6000) / 100).toString().padStart(2, '0')
val ms = (timeCentiseconds % 100).toString().padStart(2, '0')

binding.textViewTime.text = "$m : $s : $ms"
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

getFormattedTime(), updateTimerText() 함수의 return 모두 string resource에서 선언하신 time_format, time_format_simple을 사용하셔도 좋아보입니다.

Comment on lines +54 to +62
binding.buttonLap.setOnClickListener {
val currentText = getFormattedTime()
val secondsElapsed = timeCentiseconds / 100
val lapRecord = getString(R.string.lap_record_format, secondsElapsed, currentText)

lapList.add(0, lapRecord)
lapAdapter.notifyItemInserted(0)
binding.recyclerViewLaps.scrollToPosition(0)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

리스트 변경은 LapAdapter에서 변경하고 mainactivity에서는 데이터를 불러만 오도록 하시는 것이 캡슐화 원칙에 더 부합해 보입니다.

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