diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..b71f718 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 30bace4..4fe7e5c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "com.infra.infraandroid" minSdk 23 targetSdk 31 - versionCode 1 - versionName "1.0" + versionCode 2 + versionName "1.1" buildConfigField("String", "WEB_CLIENT_ID", '"953936170275-n0h7o7932npcdaa9n0e97ihuruugspeg.apps.googleusercontent.com"') testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } diff --git a/app/release/app-release.aab b/app/release/app-release.aab index c8bf9f4..26d2003 100644 Binary files a/app/release/app-release.aab and b/app/release/app-release.aab differ diff --git a/app/src/main/java/com/infra/infraandroid/id/model/RequestUserData.kt b/app/src/main/java/com/infra/infraandroid/id/model/RequestUserData.kt index 18a8933..34eceec 100644 --- a/app/src/main/java/com/infra/infraandroid/id/model/RequestUserData.kt +++ b/app/src/main/java/com/infra/infraandroid/id/model/RequestUserData.kt @@ -10,5 +10,7 @@ data class RequestUserData( @SerializedName("user_phone") var userPhone : String, @SerializedName("user_email") - var userEmail : String + var userEmail : String, + @SerializedName("user_nickname") + var userNickName : String ) diff --git a/app/src/main/java/com/infra/infraandroid/id/view/SignUpFirstFragment.kt b/app/src/main/java/com/infra/infraandroid/id/view/SignUpFirstFragment.kt index e227c25..76e9c67 100644 --- a/app/src/main/java/com/infra/infraandroid/id/view/SignUpFirstFragment.kt +++ b/app/src/main/java/com/infra/infraandroid/id/view/SignUpFirstFragment.kt @@ -1,5 +1,6 @@ package com.infra.infraandroid.id.view +import android.content.Context import android.os.Bundle import android.text.Editable import android.text.InputType @@ -8,11 +9,13 @@ import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.view.inputmethod.InputMethodManager import android.widget.EditText import android.widget.ImageView import android.widget.TextView import android.widget.Toast import androidx.appcompat.widget.AppCompatButton +import androidx.core.content.ContextCompat.getSystemService import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels @@ -64,6 +67,7 @@ class SignUpFirstFragment : Fragment() { val goToSecondSignUpButton = mBinding?.goToSecondSignUpButton as AppCompatButton val doNotUseThisIdTextView = mBinding?.doNotUseThisIdTextView as TextView + // 아이디 생성 유효성 검사 및 정규식 inputMakeIdEdittext.addTextChangedListener(object: TextWatcher{ override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { diff --git a/app/src/main/java/com/infra/infraandroid/id/view/SignUpSecondFragment.kt b/app/src/main/java/com/infra/infraandroid/id/view/SignUpSecondFragment.kt index aef5df9..37b7086 100644 --- a/app/src/main/java/com/infra/infraandroid/id/view/SignUpSecondFragment.kt +++ b/app/src/main/java/com/infra/infraandroid/id/view/SignUpSecondFragment.kt @@ -1,6 +1,7 @@ package com.infra.infraandroid.id.view import android.os.Bundle +import android.telephony.PhoneNumberFormattingTextWatcher import android.text.Editable import android.text.TextWatcher import android.util.Log @@ -63,6 +64,7 @@ class SignUpSecondFragment : Fragment(){ val retryTextView = mBinding?.reInputCodeTextView as TextView val certifyImageView = mBinding?.certifyCodeImageView as ImageView + inputPhoneNumberEditText.addTextChangedListener(PhoneNumberFormattingTextWatcher()) // 전화번호 유효성 검사, 정규식 표현 inputPhoneNumberEditText.addTextChangedListener(object : TextWatcher { diff --git a/app/src/main/java/com/infra/infraandroid/id/view/SignUpThirdFragment.kt b/app/src/main/java/com/infra/infraandroid/id/view/SignUpThirdFragment.kt index 09a1b7b..4f77a19 100644 --- a/app/src/main/java/com/infra/infraandroid/id/view/SignUpThirdFragment.kt +++ b/app/src/main/java/com/infra/infraandroid/id/view/SignUpThirdFragment.kt @@ -11,6 +11,7 @@ import android.view.ViewGroup import android.widget.EditText import android.widget.Toast import androidx.appcompat.widget.AppCompatButton +import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.navigation.findNavController @@ -21,9 +22,12 @@ import com.infra.infraandroid.id.model.RequestUserData import com.infra.infraandroid.id.model.ResponseUserData import com.infra.infraandroid.util.ServiceCreator import com.infra.infraandroid.id.viewmodel.SignUpViewModel +import com.infra.infraandroid.myinfo.myinfomodify.model.RequestNicknameCheckData +import com.infra.infraandroid.myinfo.myinfomodify.model.ResponseNicknameCheckData import retrofit2.Call import retrofit2.Callback import retrofit2.Response +import java.util.regex.Pattern // 회원가입 third depth 페이지 (닉네임 설정) @@ -35,6 +39,7 @@ import retrofit2.Response class SignUpThirdFragment : Fragment(){ private var mBinding : FragmentSignUpThirdBinding? = null private val sharedViewModel : SignUpViewModel by activityViewModels() + private var isChecked : Boolean = false override fun onCreateView( inflater: LayoutInflater, @@ -62,13 +67,13 @@ class SignUpThirdFragment : Fragment(){ override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { if (Patterns.EMAIL_ADDRESS.matcher(email.text.toString()).matches()) { - nextButton.isEnabled = true + nextButton.isEnabled = isChecked } } override fun afterTextChanged(p0: Editable?) { if (Patterns.EMAIL_ADDRESS.matcher(email.text.toString()).matches()) { - nextButton.isEnabled = true + nextButton.isEnabled = isChecked } } }) @@ -80,7 +85,8 @@ class SignUpThirdFragment : Fragment(){ userId = "", userPw = "", userPhone = "", - userEmail = "" + userEmail = "", + userNickName = "" ) sharedViewModel.currentInputId.observe(viewLifecycleOwner) { currentInputId -> requestUserData.userId = currentInputId @@ -95,6 +101,8 @@ class SignUpThirdFragment : Fragment(){ requestUserData.userEmail = currentInputEmail } + requestUserData.userNickName = mBinding?.inputNicknameEditText?.text.toString() + val call: Call = ServiceCreator.signUpService .postSignUp(requestUserData) @@ -149,6 +157,62 @@ class SignUpThirdFragment : Fragment(){ }) } + + mBinding?.inputNicknameEditText?.addTextChangedListener(object: TextWatcher{ + override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { + mBinding?.checkButton?.isEnabled = false + } + + override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { + mBinding?.checkButton?.isEnabled = mBinding?.inputNicknameEditText?.text?.length!! in 2..6 + } + + override fun afterTextChanged(p0: Editable?) { + mBinding?.checkButton?.isEnabled = mBinding?.inputNicknameEditText?.text?.length!! in 2..6 + } + }) + + + mBinding?.checkButton?.setOnClickListener{ + //닉네임 중복 서버 연결 + + val requestNicknameCheckData = RequestNicknameCheckData( + userNickname = mBinding?.inputNicknameEditText?.text.toString(), + ) + + val call: Call = ServiceCreator.nicknameDoubleCheckService + .doublecheck(requestNicknameCheckData) + call.enqueue(object : Callback{ + override fun onResponse( + call: Call, + response: Response + ) { + if(response.isSuccessful){ + val data = response.body()?.code + if(data==1000) { + isChecked = true + mBinding?.doNotUseThisNickNameTextView?.isVisible = false + mBinding?.canUseIconImageView?.isVisible = true + mBinding?.inputNicknameEditText?.setBackgroundResource(R.drawable.can_use_this_id_background) + nextButton.isEnabled = true + } + if(data==3104){ + mBinding?.doNotUseThisNickNameTextView?.isVisible = true + mBinding?.canUseIconImageView?.isVisible = false + mBinding?.inputNicknameEditText?.setBackgroundResource(R.drawable.double_check_id_background) + nextButton.isEnabled = false + } + } + } + + override fun onFailure(call: Call, t: Throwable) { + + } + + }) + } + + } override fun onDestroyView() { diff --git a/app/src/main/res/layout/fragment_sign_up_first.xml b/app/src/main/res/layout/fragment_sign_up_first.xml index cd89432..e97ba51 100644 --- a/app/src/main/res/layout/fragment_sign_up_first.xml +++ b/app/src/main/res/layout/fragment_sign_up_first.xml @@ -1,229 +1,233 @@ - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - \ No newline at end of file + android:layout_height="match_parent" + android:background="@color/infra_gray_c" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + tools:context="com.infra.infraandroid.id.view.SignUpFirstFragment"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_sign_up_second.xml b/app/src/main/res/layout/fragment_sign_up_second.xml index c3e38c0..c88b200 100644 --- a/app/src/main/res/layout/fragment_sign_up_second.xml +++ b/app/src/main/res/layout/fragment_sign_up_second.xml @@ -1,172 +1,180 @@ - + xmlns:android="http://schemas.android.com/apk/res/android"> + - + - + - + - + - + - + - + - + - + - + - + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_sign_up_third.xml b/app/src/main/res/layout/fragment_sign_up_third.xml index 577ab96..c85a2b8 100644 --- a/app/src/main/res/layout/fragment_sign_up_third.xml +++ b/app/src/main/res/layout/fragment_sign_up_third.xml @@ -1,90 +1,174 @@ - + xmlns:android="http://schemas.android.com/apk/res/android"> + - + - + - + - + - + + + + + + + + + + + + - \ No newline at end of file + + \ No newline at end of file