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

7차 과제 구현 완....료는 아니고 중..... #5

Open
wants to merge 10 commits into
base: develop/view
Choose a base branch
from

Conversation

ahra1221
Copy link
Member

map이 안된다는.... 사실을..... 11시 40분에 알았다는....

Copy link

@l2hyunwoo l2hyunwoo left a comment

Choose a reason for hiding this comment

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

👍🏻

adapter.setRepoList(userViewModel.userList)
Log.e("Response", "onResponse: ${userViewModel.userList}" )
adapter.setMusicList(musicShowViewModel.musicList)
Log.e("Response", "onResponse: ${musicShowViewModel.musicList}" )

Choose a reason for hiding this comment

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

Suggested change
Log.e("Response", "onResponse: ${musicShowViewModel.musicList}" )
Log.d("Response", "onResponse: ${musicShowViewModel.musicList}" )

대개 e는 에러가 발생했을 때 사용하는거여서 d를 사용하는게 좋아

Choose a reason for hiding this comment

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

헉 하나 배워갑니다 !!

Comment on lines +15 to +16
class MusicViewHolder(private val binding: ItemLayoutBinding)
: RecyclerView.ViewHolder(binding.root) {

Choose a reason for hiding this comment

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

Suggested change
class MusicViewHolder(private val binding: ItemLayoutBinding)
: RecyclerView.ViewHolder(binding.root) {
class MusicViewHolder(
private val binding: ItemLayoutBinding
) : RecyclerView.ViewHolder(binding.root) {

Comment on lines +18 to +20
binding.ivAlbum.load(data.image)
binding.tvTitle.text = data.title
binding.tvSinger.text = data.singer

Choose a reason for hiding this comment

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

Suggested change
binding.ivAlbum.load(data.image)
binding.tvTitle.text = data.title
binding.tvSinger.text = data.singer
with(binding) {
ivAlbum.load(data.image)
tvTitle.text = data.title
tvSinger.text = data.singer
}

Choose a reason for hiding this comment

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

와,, 배워갑니다

}

override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is MusicViewHolder) holder.setMusic(musicList[position])

Choose a reason for hiding this comment

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

Suggested change
if (holder is MusicViewHolder) holder.setMusic(musicList[position])
(holder is MusicViewHolder).let{ it.setMusic(musicList[position]) }

이렇게도 작성할 수 있어!

Choose a reason for hiding this comment

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

코틀린의 확장함수,, let, with, run, apply, also
시험끝나고 공부해 봐야지

Comment on lines +42 to +43
map["request"] = "{\"title\": \"$title\", \"singer\": \"$singer\"}".toRequestBody("application/json".toMediaTypeOrNull())
viewModel.addMusic(map)

Choose a reason for hiding this comment

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

이게 그 실패의 흔적....!

Comment on lines +31 to +37
private fun idRegex(id : String) : Boolean{
return id.matches("^(?=.*[A-Za-z])(?=.*[0-9])[A-Za-z[0-9]]{6,10}$".toRegex())
}

private fun pwRegex(pw : String) : Boolean{
return pw.matches("^(?=.*[A-Za-z])(?=.*[0-9])(?=.*[!@#$%^&*?])[A-Za-z[0-9]!@#\$%^&*?]{6,12}$".toRegex())
}

Choose a reason for hiding this comment

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

Regex 객체는 생성할 때 비용이 커서 미리 변수로 만들어놓는게 좋을 것 같아!

Choose a reason for hiding this comment

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

companion object를 사용해 봅시다 !

Comment on lines +45 to +58
edtSignupId.addTextChangedListener(object : TextWatcher{
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(s: Editable?) {
if(idRegex(edtSignupId.text.toString())){
textinputlayoutId.error = null
idFlag = true
}
else{
textinputlayoutId.error = "아이디 형식이 올바르지 않습니다."
}
flagCheck()
}
})

Choose a reason for hiding this comment

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

Suggested change
edtSignupId.addTextChangedListener(object : TextWatcher{
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(s: Editable?) {
if(idRegex(edtSignupId.text.toString())){
textinputlayoutId.error = null
idFlag = true
}
else{
textinputlayoutId.error = "아이디 형식이 올바르지 않습니다."
}
flagCheck()
}
})
edtSignupId.doAfterTextChanged {
if (idRegex(edtSignupId.text.toString())){
textinputlayoutId.error = null
idFlag = true
}
else {
textinputlayoutId.error = "아이디 형식이 올바르지 않습니다."
}
flagCheck()
}
}

doAfterTextChanged 사용하면 좀 더 깔끔할 듯?

@POST("music")
fun addMusic(
@Part image : MultipartBody.Part?,
@Part ("request") request: RequestBody

Choose a reason for hiding this comment

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

Suggested change
@Part ("request") request: RequestBody
@Part request: RequestBody

Choose a reason for hiding this comment

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

오 이거 없어도 되는구나

Comment on lines +44 to +46
<meta-data
android:name="android.app.lib_name"
android:value="" />

Choose a reason for hiding this comment

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

얘모임???

Comment on lines +21 to +22
private val musicShowService = MusicServicePool.musicShowService
private val musicShowViewModel by viewModels<MusicShowViewModel>()

Choose a reason for hiding this comment

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

홈 프래그먼트 버리고 이거로 바꿨네 ㅋㅋㅋㅋ 안아까워??

import okhttp3.RequestBody.Companion.toRequestBody
import org.sopt.sample.MainActivity

class MusicAddActivity : AppCompatActivity() {

Choose a reason for hiding this comment

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

오 새 창 띄워서 입력하기 ㅋㅋㅋ 성실한데?

Comment on lines +3 to +9
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="inputId">제목을 입력하세요</string>
<string name="inputPw">비밀번호를 입력하세요</string>
<string name="inputName">이름을 입력하세요</string>
<string name="inputTitle">노래제목을 입력하세요</string>
<string name="inputSinger">가수를 입력하세요</string>

Choose a reason for hiding this comment

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

스트링 리소스 굳굳

Copy link

@giovannijunseokim giovannijunseokim left a comment

Choose a reason for hiding this comment

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

좀만 더 화이팅 ~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants