[정현수_Android] 7주차 과제 제출#8
Conversation
| MediaStore.Audio.Media.DURATION | ||
| ) | ||
|
|
||
| val query = contentResolver.query(collection, projection, null, null, null) |
There was a problem hiding this comment.
현재는 메인 스레드에서 동작합니다. 불러오는 음악 리스트가 많을 경우 ANR 오류가 발생할 수 있으므로 Dispatchers.IO 코루틴 등의 사용이 필요해 보입니다.
| val title = cursor.getString(titleColumn) | ||
| val artist = cursor.getString(artistColumn) |
There was a problem hiding this comment.
title이나 artist에 null이 들어올 수 있습니다. 하지만 MusicItem 데이터 클래스에서는 non-null 타입으로 선언했으므로 null이 들어올 경우 NPE 오류가 발생합니다. Null check가 필요해 보입니다.
| mediaPlayer = MediaPlayer.create(this, uri).apply { | ||
| start() |
There was a problem hiding this comment.
create() 함수는 null을 반환할 수 있습니다. 현재 코드에서 safe call 없이 바로 apply를 호출하면 NPE 오류가 발생합니다. null check가 필요해 보입니다.
There was a problem hiding this comment.
tvBottomTitle, tvBottomArtist에서 긴 글자에 대한 처리가 필요해 보입니다. maxLines, ellipsize와 같이 글자가 길어질 때에 대한 처리를 알아보시는 것도 좋아보입니다.
There was a problem hiding this comment.
tvTitle, tvArtist에서 긴 글자에 대한 처리가 필요해 보입니다. maxLines, ellipsize와 같이 글자가 길어질 때에 대한 처리를 알아보시는 것도 좋아보입니다.
| <LinearLayout | ||
| android:id="@+id/layoutBottomPlayer" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="64dp" |
There was a problem hiding this comment.
height를 64dp로 고정하실 경우 특정 상황(예: 하위 textView의 height가 64dp를 넘어갈 경우)에서 글자가 잘리는 등의 UI적인 문제가 발생할 수 있습니다. 만약 특정 높이 이상을 보장하고 싶을 경우 minHeight와 wrap_content를 같이 사용하는 방법도 좋아보입니다.
No description provided.