-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: develop/view
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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}" ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log.e("Response", "onResponse: ${musicShowViewModel.musicList}" ) | |
Log.d("Response", "onResponse: ${musicShowViewModel.musicList}" ) |
대개 e는 에러가 발생했을 때 사용하는거여서 d를 사용하는게 좋아
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉 하나 배워갑니다 !!
class MusicViewHolder(private val binding: ItemLayoutBinding) | ||
: RecyclerView.ViewHolder(binding.root) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class MusicViewHolder(private val binding: ItemLayoutBinding) | |
: RecyclerView.ViewHolder(binding.root) { | |
class MusicViewHolder( | |
private val binding: ItemLayoutBinding | |
) : RecyclerView.ViewHolder(binding.root) { |
binding.ivAlbum.load(data.image) | ||
binding.tvTitle.text = data.title | ||
binding.tvSinger.text = data.singer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |
} |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (holder is MusicViewHolder) holder.setMusic(musicList[position]) | |
(holder is MusicViewHolder).let{ it.setMusic(musicList[position]) } |
이렇게도 작성할 수 있어!
There was a problem hiding this comment.
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
시험끝나고 공부해 봐야지
map["request"] = "{\"title\": \"$title\", \"singer\": \"$singer\"}".toRequestBody("application/json".toMediaTypeOrNull()) | ||
viewModel.addMusic(map) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이게 그 실패의 흔적....!
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()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex 객체는 생성할 때 비용이 커서 미리 변수로 만들어놓는게 좋을 것 같아!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
companion object를 사용해 봅시다 !
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() | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Part ("request") request: RequestBody | |
@Part request: RequestBody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 이거 없어도 되는구나
<meta-data | ||
android:name="android.app.lib_name" | ||
android:value="" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
얘모임???
private val musicShowService = MusicServicePool.musicShowService | ||
private val musicShowViewModel by viewModels<MusicShowViewModel>() |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 새 창 띄워서 입력하기 ㅋㅋㅋ 성실한데?
<!-- 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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스트링 리소스 굳굳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좀만 더 화이팅 ~~~
map이 안된다는.... 사실을..... 11시 40분에 알았다는....