|
@@ -2,9 +2,15 @@ package com.sambath.sbc.screen.register
|
|
|
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
import android.os.Bundle
|
|
|
+import android.view.View
|
|
|
import android.widget.ArrayAdapter
|
|
|
import com.sambath.sbc.R
|
|
|
import kotlinx.android.synthetic.main.activity_register.et_gender
|
|
|
+import kotlinx.android.synthetic.main.activity_register.radioButtonEmail
|
|
|
+import kotlinx.android.synthetic.main.activity_register.radioButtonPhone
|
|
|
+import kotlinx.android.synthetic.main.activity_register.radioGroup
|
|
|
+import kotlinx.android.synthetic.main.activity_register.til_email
|
|
|
+import kotlinx.android.synthetic.main.activity_register.til_phone
|
|
|
|
|
|
class RegisterActivity : AppCompatActivity() {
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
@@ -16,5 +22,30 @@ class RegisterActivity : AppCompatActivity() {
|
|
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
|
|
et_gender.adapter = adapter
|
|
|
et_gender.setSelection(0)
|
|
|
+
|
|
|
+ setGender()
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun setGender() {
|
|
|
+ if (radioGroup.checkedRadioButtonId == R.id.radioButtonEmail) {
|
|
|
+ til_email.visibility = View.VISIBLE
|
|
|
+ til_phone.visibility = View.GONE
|
|
|
+ } else if (radioGroup.checkedRadioButtonId == R.id.radioButtonPhone) {
|
|
|
+ til_email.visibility = View.GONE
|
|
|
+ til_phone.visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+
|
|
|
+ radioGroup.setOnCheckedChangeListener { _, checkedId ->
|
|
|
+ when (checkedId) {
|
|
|
+ R.id.radioButtonEmail -> {
|
|
|
+ til_email.visibility = View.VISIBLE
|
|
|
+ til_phone.visibility = View.GONE
|
|
|
+ }
|
|
|
+ R.id.radioButtonPhone -> {
|
|
|
+ til_email.visibility = View.GONE
|
|
|
+ til_phone.visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|