Open
Conversation
KYM-P
approved these changes
Jul 3, 2025
|
|
||
| private fun showMusicList() { | ||
| lifecycleScope.launch { | ||
| val musicList = withContext(Dispatchers.IO) { |
There was a problem hiding this comment.
데이터베이스 작업을 다른 스레드에서 실행하는 것 매우 좋습니다!
여기서 나중에 배울 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.
이런 제목없음, 가수없음 도 사용자에게 보여주는 메시지로 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.
만약 진짜로 log 를 사용하신다면 KEY 값도 Constant 로 만드시는게 좋지만 여기서는 단순 작동을 확인하기 위한 임시코드라고 생각하여 리뷰에서는 제외하겠습니다.
| android:id="@+id/tv_title" | ||
| android:layout_width="0dp" | ||
| android:layout_height="wrap_content" | ||
| android:text="제목" |
| android:id="@+id/tv_artist" | ||
| android:layout_width="0dp" | ||
| android:layout_height="wrap_content" | ||
| android:text="가수" |
| */ | ||
| ) | ||
|
|
||
| @Composable |
There was a problem hiding this comment.
ui/theme에 Color, Theme, Type 은 Compose 연습용인건가요?
같이 들어와버렸네요
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.