Skip to content

Commit

Permalink
#11 / [MOD] signUp 메소드 인자를 뷰모델 활용으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Jun 5, 2023
1 parent da9d2ab commit 888dc41
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SignUpActivity : BindingActivity<ActivitySignUpBinding>(R.layout.activity_

// SignUp 버튼 클릭
binding.btnSignUp.setOnClickListener {
signUpWithServer()
viewModel.signUp()
}

// 화면 터치로 키보드 내리기
Expand Down Expand Up @@ -69,15 +69,6 @@ class SignUpActivity : BindingActivity<ActivitySignUpBinding>(R.layout.activity_
}
}

private fun signUpWithServer() {
viewModel.signUp(
binding.etSignUpId.text.toString(),
binding.etSignUpPw.text.toString(),
binding.etSignUpName.text.toString(),
binding.etSignUpSkill.text.toString()
)
}

private fun hideKeyboard(activity: Activity) {
val keyboard = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
keyboard.hideSoftInputFromWindow(activity.window.decorView.applicationWindowToken, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class SignUpViewModel : ViewModel() {

val isButtonValid: MutableLiveData<Boolean> = MutableLiveData(false)

fun signUp(id: String, password: String, name: String, skill: String) {
fun signUp() {
AuthServicePool.authService.signUp(
SignUpRequestDTO(
id, password, name, skill
idText.toString(), pwText.toString(), nameText.toString(), skillText.toString()
)
).enqueue(object : Callback<SignUpResponseDTO> {
override fun onResponse(
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_sign_up.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
android:id="@+id/et_sign_up_skill"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:imeOptions="actionDone"
android:inputType="text"
android:text="@={vm.skillText}" />

Expand Down

0 comments on commit 888dc41

Please sign in to comment.