Skip to content

Conversation

@kkyoungchan
Copy link

No description provided.

Copy link

@KYM-P KYM-P left a comment

Choose a reason for hiding this comment

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

GOOD


private fun showMusicList() {
lifecycleScope.launch {
val musicList = withContext(Dispatchers.IO) {
Copy link

Choose a reason for hiding this comment

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

데이터베이스 작업을 다른 스레드에서 실행하는 것 매우 좋습니다!
여기서 나중에 배울 progressbar 에 대해 설명하자면 musicList 를 불러오는 동안 사용자 UI 에는 단지 빈 화면에서 갑자기 리스트가 생기기 때문에 해당 작업을 하는 도중에는 main 스레드에서 로딩 화면을 보여주는게 일반적입니다. 나중에 배우실 때 이 부분을 기억하시면 좋을 것 같습니다.

while (it.moveToNext()) {
val id = it.getLong(idIndex)
val title = it.getString(titleIndex) ?: "제목없음"
val artist = it.getString(artistIndex) ?: "가수없음"
Copy link

Choose a reason for hiding this comment

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

이런 제목없음, 가수없음 도 사용자에게 보여주는 메시지로 strings.xml 로 빼는게 좋을 것 같습니다.

private val musicUpdateReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
val title = intent?.getStringExtra(MusicPlayerService.SONG_TITLE) ?: return
Log.d("MainActivity", "Music update received: $title")
Copy link

Choose a reason for hiding this comment

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

만약 진짜로 log 를 사용하신다면 KEY 값도 Constant 로 만드시는게 좋지만 여기서는 단순 작동을 확인하기 위한 임시코드라고 생각하여 리뷰에서는 제외하겠습니다.

android:id="@+id/tv_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="제목"
Copy link

Choose a reason for hiding this comment

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

strings.xml 을 만드셨는데 적용을 안하셨군요.

android:id="@+id/tv_artist"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="가수"
Copy link

Choose a reason for hiding this comment

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

여기도 있네요

*/
)

@Composable
Copy link

Choose a reason for hiding this comment

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

ui/theme에 Color, Theme, Type 은 Compose 연습용인건가요?
같이 들어와버렸네요

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