Merge remote-tracking branch 'origin/master'

This commit is contained in:
AngelSuarez03 2024-04-22 07:46:59 -06:00
commit de9641a6eb
2 changed files with 11 additions and 4 deletions

View File

@ -1,7 +1,9 @@
package com.terratenientes.medicalhealth package com.terratenientes.medicalhealth
import android.R
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.Toast import android.widget.Toast
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
@ -22,6 +24,11 @@ class AgregarActivity : AppCompatActivity() {
setContentView(view) setContentView(view)
db = DoctorDataBaseHelper(this@AgregarActivity) db = DoctorDataBaseHelper(this@AgregarActivity)
val opcionesGenero = arrayOf("Masculino", "Femenino", "Otro")
val adapter = ArrayAdapter(this, R.layout.simple_spinner_item, opcionesGenero)
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
binding.edtxSexo.adapter = adapter
binding.btnConfirmar.setOnClickListener { binding.btnConfirmar.setOnClickListener {
agregarPaciente() agregarPaciente()
val intent = Intent(this@AgregarActivity, EliminarActivity::class.java) val intent = Intent(this@AgregarActivity, EliminarActivity::class.java)
@ -33,7 +40,7 @@ class AgregarActivity : AppCompatActivity() {
val apellidoPaterno = binding.edtxApellidoPat.text.toString() val apellidoPaterno = binding.edtxApellidoPat.text.toString()
val apellidoMaterno = binding.edtxApellidoMat.text.toString() val apellidoMaterno = binding.edtxApellidoMat.text.toString()
val edad = binding.edtxEdad.text.toString().toIntOrNull() val edad = binding.edtxEdad.text.toString().toIntOrNull()
val sexo = binding.edtxSexo.text.toString() val sexo = binding.edtxSexo.selectedItem.toString() // Obtener el valor seleccionado del Spinner
val domicilio = binding.edtxDomicilio.text.toString() val domicilio = binding.edtxDomicilio.text.toString()
if (nombre.isNotEmpty() && apellidoPaterno.isNotEmpty() && apellidoMaterno.isNotEmpty() && edad != null && sexo.isNotEmpty() && domicilio.isNotEmpty()) { if (nombre.isNotEmpty() && apellidoPaterno.isNotEmpty() && apellidoMaterno.isNotEmpty() && edad != null && sexo.isNotEmpty() && domicilio.isNotEmpty()) {

View File

@ -48,14 +48,13 @@
android:digits="1234567890" android:digits="1234567890"
/> />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
android:text="@string/et_modificar_sexo" /> android:text="@string/et_modificar_sexo" />
<EditText <Spinner
android:id="@+id/edtx_sexo" android:id="@+id/edtx_sexo"
android:layout_width="109dp" android:layout_width="109dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -135,3 +134,4 @@
android:layout_marginEnd="50dp"/> android:layout_marginEnd="50dp"/>
</LinearLayout> </LinearLayout>