-
Notifications
You must be signed in to change notification settings - Fork 12
[김영찬_Android] 10주차 과제 제출 #71
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
base: main
Are you sure you want to change the base?
Conversation
KYM-P
left a comment
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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) ?: "가수없음" |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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="제목" |
There was a problem hiding this comment.
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="가수" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 있네요
| */ | ||
| ) | ||
|
|
||
| @Composable |
There was a problem hiding this comment.
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 연습용인건가요?
같이 들어와버렸네요
No description provided.