|
@ -2,19 +2,22 @@ package com.nivesh.production.niveshfd.partnerOnBoarding.ui.fragments1 |
|
|
|
|
|
|
|
|
import android.os.Bundle |
|
|
import android.os.Bundle |
|
|
import android.text.Editable |
|
|
import android.text.Editable |
|
|
|
|
|
import android.text.InputFilter |
|
|
import android.text.TextWatcher |
|
|
import android.text.TextWatcher |
|
|
import android.view.LayoutInflater |
|
|
import android.view.LayoutInflater |
|
|
import android.view.View |
|
|
import android.view.View |
|
|
import android.view.ViewGroup |
|
|
import android.view.ViewGroup |
|
|
import androidx.fragment.app.Fragment |
|
|
|
|
|
import com.nivesh.production.niveshfd.R |
|
|
import com.nivesh.production.niveshfd.R |
|
|
import com.nivesh.production.niveshfd.databinding.FragmentSignupBinding |
|
|
import com.nivesh.production.niveshfd.databinding.FragmentSignupBinding |
|
|
|
|
|
import com.nivesh.production.niveshfd.fd.ui.activity.BaseActivity |
|
|
import com.nivesh.production.niveshfd.fd.util.Common |
|
|
import com.nivesh.production.niveshfd.fd.util.Common |
|
|
|
|
|
|
|
|
class SignUpFragment : Fragment() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SignUpFragment : BaseFragment() { |
|
|
private var _binding: FragmentSignupBinding? = null |
|
|
private var _binding: FragmentSignupBinding? = null |
|
|
private val binding get() = _binding!! |
|
|
private val binding get() = _binding!! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateView( |
|
|
override fun onCreateView( |
|
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? |
|
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? |
|
|
): View { |
|
|
): View { |
|
@ -28,6 +31,7 @@ class SignUpFragment : Fragment() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun init() { |
|
|
private fun init() { |
|
|
|
|
|
binding.edtMobileNumber.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(10)) |
|
|
binding.edtMobileNumber.addTextChangedListener(object : TextWatcher { |
|
|
binding.edtMobileNumber.addTextChangedListener(object : TextWatcher { |
|
|
override fun afterTextChanged(s: Editable?) {} |
|
|
override fun afterTextChanged(s: Editable?) {} |
|
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} |
|
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} |
|
@ -38,19 +42,26 @@ class SignUpFragment : Fragment() { |
|
|
|
|
|
|
|
|
binding.btnSignUp.setOnClickListener { |
|
|
binding.btnSignUp.setOnClickListener { |
|
|
if (validate()) { |
|
|
if (validate()) { |
|
|
|
|
|
|
|
|
|
|
|
replaceFragment( |
|
|
|
|
|
activity as BaseActivity, |
|
|
|
|
|
com.nivesh.production.niveshfd.R.id.signUpContainer, |
|
|
|
|
|
OTPFragment(), |
|
|
|
|
|
"OTP", |
|
|
|
|
|
true |
|
|
|
|
|
) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun validate(): Boolean { |
|
|
private fun validate(): Boolean { |
|
|
return if (binding.edtMobileNumber.text.toString().isEmpty()) { // EditText |
|
|
return if (binding.edtMobileNumber.text.toString().isEmpty()) { // EditText |
|
|
Common.commonErrorMethod( |
|
|
Common.commonErrorMethod( |
|
|
binding.edtMobileNumber, |
|
|
binding.edtMobileNumber, |
|
|
binding.tlMobileNumber, |
|
|
binding.tlMobileNumber, |
|
|
getString(R.string.emptyMobileNumber) |
|
|
|
|
|
|
|
|
getString(com.nivesh.production.niveshfd.R.string.emptyMobileNumber) |
|
|
) |
|
|
) |
|
|
} else if (!Common.isIndianMobileNo(binding.edtMobileNumber.text.toString())) { // EditText |
|
|
|
|
|
|
|
|
} else if (binding.edtMobileNumber.text?.length != 10) { // EditText |
|
|
Common.commonErrorMethod( |
|
|
Common.commonErrorMethod( |
|
|
binding.edtMobileNumber, |
|
|
binding.edtMobileNumber, |
|
|
binding.tlMobileNumber, |
|
|
binding.tlMobileNumber, |
|
|