Skip to content
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

최근 추가된 노래 클릭시 플레이어 화면으로 이동 #272

Merged
merged 10 commits into from
Dec 5, 2023

Conversation

HamBP
Copy link
Member

@HamBP HamBP commented Dec 5, 2023

Issue

Overview

  • 타 화면에서 플레이어 화면으로 이동하면서 재생할 목록과 노래 정보를 전달한다.

To Reviewers

  • 지난주 코드를 기반으로 작업한 코드라 충돌이 발생하는데, 우선 로직 위주로 확인해주면 될 것 같아. 이후에 merge하고 다시 push할게!

@HamBP HamBP added ✨ feat 기능 개발 🤖 android android labels Dec 5, 2023
@HamBP HamBP added this to the 🎶 music player milestone Dec 5, 2023
@HamBP HamBP self-assigned this Dec 5, 2023
Copy link
Collaborator

@2taezeat 2taezeat left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~

Channel, Usecase를 사용한 이유를 문서로 남겨도 좋을 것 같습니다~

)
}
}

fun interface Listener {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Listener 네이밍, 더 명확히 작성하시면 어떨까요?

아니면 MusicAdapter 생성자 변수 'listener'를 더 명확히 해도 좋습니다. 둘 중 하나는 하면 좋을 거 같아요

class MusicAdapter(
    private val musicItemOrientation: Orientation,
    private val listener: Listener = Listener { }, // todo : 클릭 이벤트 구현이 완료되면 디폴트 값을 지워주세요.
)

Copy link
Member Author

Choose a reason for hiding this comment

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

Listener는 중첩 인터페이스라 Adapter 내부에서는 Listener로 접근이 가능하지만, 외부에서는 MusicAdapter.Listener처럼 접근해야 돼. media3 라이브러리의 리스너도 Player.Listener처럼 작성되어서 리스너라는 이름만 사용했어. 혹시 피드백이 이 내용이 맞을까?

Copy link
Member Author

Choose a reason for hiding this comment

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

그런데 클릭 이벤트 처리는 data class의 람다로 처리한다고 해서, 이 코드는 아마 바뀔 것 같아

Copy link
Collaborator

Choose a reason for hiding this comment

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

        binding.rvRecentlyAddedSong.adapter = MusicAdapter(
            musicItemOrientation = Orientation.HORIZONTAL,
            listener = viewModel,
        )

코멘트 남긴 이유는 listener = viewModel, 경우 처럼, 읽는 사람 입장에서 너무 추상적이여서 입니다~

바뀌면 상관 없습니다~

Copy link
Member Author

Choose a reason for hiding this comment

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

업캐스팅하거나, 자동 타입 캐스팅을 이용하는 경우가 흔한 것 같아서 저는 괜찮다고 생각해요.
image
this는 activity이지만 실제 파라미터는 context인 것처럼요.

Copy link
Member

Choose a reason for hiding this comment

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

람다 처리 관련 부분은 따로 이슈 생성하시는 건가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

머지하면서 리팩터링 할 수있으면 하려구요!

Copy link
Member Author

Choose a reason for hiding this comment

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

흐음... 오늘은 좀 지쳐서 이슈 만들어 놓고 다음에 적용할게요 ㅠㅠ

Copy link
Member

@youlalala youlalala left a comment

Choose a reason for hiding this comment

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

많은 고민이 담긴 코드인게 보이네용 ㅎㅎ 고생하셨습니다~~

player.clearMediaItems()
player.setMediaItems(newItems)

val index = newPlaylist.musics.indexOf(newPlaylist.startMusic)
Copy link
Member

@youlalala youlalala Dec 5, 2023

Choose a reason for hiding this comment

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

usecase 에서 index 를 구하고, playlist 랑 start index 를 넘겨주면 이 코드는 presentation 에 없어도 될 것 같네요!

Copy link
Member Author

Choose a reason for hiding this comment

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

UseCase에서는 "일단 많은 정보를 포함하고, 어떻게 사용하는지는 신경쓰지 않는다"라는 의도로 설계했어요.
7~8주차 페어프로그래밍 때 처음엔 id만 전달했다가 나중에 객체 전체를 전달하는 방식으로 변경되었는데요. 객체를 전달하는 편이 나중에 변경 사항이 생겼을 때 대응하기 더 쉬울 것 같은데, 어떻게 생각하시나요?

Copy link
Member

Choose a reason for hiding this comment

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

아 객체를 전달하는 것 좋아요 ! 객체는 그대로 두고 index는 멤버변수를 생각했습니당

Copy link
Member Author

Choose a reason for hiding this comment

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

아하! 좋은 방법 같네요

Copy link

github-actions bot commented Dec 5, 2023

Test Results

6 tests   6 ✔️  1s ⏱️
2 suites  0 💤
2 files    0

Results for commit 9f170e1.

@HamBP HamBP merged commit e51821b into develop Dec 5, 2023
2 checks passed
@HamBP HamBP linked an issue Dec 5, 2023 that may be closed by this pull request
@HamBP HamBP deleted the android/feature/239 branch December 5, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android android ✨ feat 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

최근 추가된 노래 클릭시 플레이어 화면으로 이동
3 participants