Conversation
There was a problem hiding this comment.
defaultConfig {
}
buildFeatures {
viewBinding = true
}
defaultConfig랑 같은 라인에 buildFeatures 안에 viewBinding을 선언하면 가독성이 더 좋습니다!
There was a problem hiding this comment.
나중에 Fragment의 생명주기에서 다룰 내용이긴 하지만 Fragment의 생성 단계가 onCreateView -> onViewCreated가 있습니다.
onCreateView에서는 View가 처음 생성되고 초기화되는 부분을 담당하고
onViewCreated에서는 View와의 상호작용이 이루어지는 곳이라서 onCreateView 말고
onViewCreated를 override 받아서 setOnClickListener 메서드를 선언하는 것이 좋습니다!
| import com.jihyun.floclonecoding.databinding.ActivitySongBinding | ||
|
|
||
| class SongActivity : | ||
| AppCompatActivity() { |
There was a problem hiding this comment.
줄바꿈은 안하시는 것이 가독성이 좋아보입니다!
| setPlayerStatus(true) | ||
|
|
||
| } | ||
| if (intent.hasExtra("title") && intent.hasExtra("singer")){ |
There was a problem hiding this comment.
val title = intent.getStringExtra("title")
val singer = intent.getStringExtra("singer")
if (title != null && singer != null) {
binding.songMusicTitleTv.text = title
binding.songSingerNameTv.text = singer
}
intent에 들어있는 변수의 존재 여부를 판별하고 저장하는 것보다는 if문에서는 null 체크만 하고 값을 사용하는 편이 더 좋아보입니다!
| } | ||
| } | ||
| private fun setPlayerStatus(isPlaying: Boolean) { | ||
| if(isPlaying){ |
There was a problem hiding this comment.
if문 판별식은 띄워쓰는 것이 일반적입니다~
There was a problem hiding this comment.
이미지 파일을 png로 많이 갖고 오신 것 같은데 Chapter 1에 png 말고 svg로 다운로드받고 다시 xml 형식으로 변환하는 과정을 다시 한 번 정독해주세요~ 물론 Udemy 강의의 이미지 파일들이 너무 많은 관계로 일일이 못하신 것 같지만 실제 프로젝트에서는 png로 할 경우 이미지의 해상도가 깨지는 경우들이 많아서 방법 정도만 숙지해놓으셔도 됩니다!
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| <FrameLayout |
There was a problem hiding this comment.
만약 FrameLayout이 Fragment 교체용으로 사용하시는 위젯이시라면 이것 대신에 FragmentContainerView를 사용하시는 것을 권장드려요~
There was a problem hiding this comment.
이렇게 앱에서 쓰이는 메인 컬러들은 resources에 일괄 저장해두시는 것 아주 좋습니다~
#️⃣연관된 이슈
📝작업 내용