From 828842db37e45eea0c3ded7a4fea9be76770b400 Mon Sep 17 00:00:00 2001 From: AngelSuarez03 Date: Sun, 2 Jun 2024 17:39:59 -0600 Subject: [PATCH] =?UTF-8?q?Correci=C3=B3n=20Logout=20ambas=20pantallas=20p?= =?UTF-8?q?rincipales?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/deploymentTargetDropDown.xml | 15 +++++++- .../medicalhealth/MainActivity.kt | 1 + .../PacientePrincipalActivity.kt | 3 ++ .../medicalhealth/PrincipalActivity.kt | 4 +++ .../medicalhealth/RegistrarDActivity.kt | 18 +++++----- app/src/main/res/drawable/logout.xml | 9 +++++ .../layout/activity_paciente_principal.xml | 8 +++++ .../main/res/layout/activity_principal.xml | 34 +++++++++++++------ app/src/main/res/layout/rc_receta_item.xml | 10 +++--- 9 files changed, 76 insertions(+), 26 deletions(-) create mode 100644 app/src/main/res/drawable/logout.xml diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 0c0c338..cc1cbde 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -3,7 +3,20 @@ - + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/terratenientes/medicalhealth/MainActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/MainActivity.kt index ad5c5cb..8cdc1c9 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/MainActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/MainActivity.kt @@ -40,6 +40,7 @@ class MainActivity : AppCompatActivity() { //dbRecetas.crearTablaReceta() //db.createTable() //dbHistorial.crearTablaHistorial() + //db.crearTablaPacientes() binding.btnIniciarSesion.setOnClickListener { historial.fecha = obtenerFecha() var res = db.validarDatos( diff --git a/app/src/main/java/com/terratenientes/medicalhealth/PacientePrincipalActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/PacientePrincipalActivity.kt index d6a9eda..eee2c84 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/PacientePrincipalActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/PacientePrincipalActivity.kt @@ -56,6 +56,9 @@ class PacientePrincipalActivity : AppCompatActivity(), CellClickListener { binding.rvRecetasPaciente.layoutManager=LinearLayoutManager(this) binding.rvRecetasPaciente.adapter= recycleAdapter + binding.ivLogout.setOnClickListener { + finish() + } } override fun onResume() { diff --git a/app/src/main/java/com/terratenientes/medicalhealth/PrincipalActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/PrincipalActivity.kt index 7b64519..47f98b9 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/PrincipalActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/PrincipalActivity.kt @@ -45,6 +45,10 @@ class PrincipalActivity : AppCompatActivity() { historial = Historial("Doctor", null,"Se inicio la actividad de menu principal", obtenerFecha()) datosDoctor(intent.getStringExtra("Cedula").toString()) añadirHistorial(historial) + binding.ivLogout.setOnClickListener { + finish() + Toast.makeText(this@PrincipalActivity,"Sesión cerrada", Toast.LENGTH_LONG).show() + } binding.ivPacientes.setOnClickListener { val intent = Intent(this@PrincipalActivity, PacienteActivity::class.java) intent.putExtra("NombreDoctor", nombreDoctor) diff --git a/app/src/main/java/com/terratenientes/medicalhealth/RegistrarDActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/RegistrarDActivity.kt index bff7828..55eaa3a 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/RegistrarDActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/RegistrarDActivity.kt @@ -29,7 +29,6 @@ class RegistrarDActivity : AppCompatActivity() { dbHistorial = HistorialDataBaseHelper(this@RegistrarDActivity) historial = Historial(null, null, "Se abrio la actividad de registro", obtenerFecha()) añadirHistorial(historial) - db= DoctorDataBaseHelper(this@RegistrarDActivity) db = DoctorDataBaseHelper(this@RegistrarDActivity) binding.btnRegistrar.setOnClickListener { @@ -46,14 +45,10 @@ class RegistrarDActivity : AppCompatActivity() { val domicilio = binding.etDomicilio.text.toString() val contrasena= binding.etContrasenaRegistro.text.toString() val usuario= Doctor(cedula,nombre,apellido,telefono,domicilio.toInt()) - db.agregarDoctores(usuario,contrasena) - Toast.makeText(this@RegistrarDActivity,"USUARIO AGREGADO",Toast.LENGTH_LONG).show() - historial.eventoRealizado = "Se registraron los datos de un doctor" - historial.fecha = obtenerFecha() - historial.tipoUsuario = "Doctor" - historial.nombreUsuario = nombre - añadirHistorial(historial) - val contrasena = binding.etContrasenaRegistro.text.toString() + /*db.agregarDoctores(usuario,contrasena) + Toast.makeText(this@RegistrarDActivity,"USUARIO AGREGADO",Toast.LENGTH_LONG).show()*/ + + if (cedula.isEmpty() || nombre.isEmpty() || apellido.isEmpty() || telefono.isEmpty() || domicilio.isEmpty() || contrasena.isEmpty()) { Toast.makeText(this, "Todos los campos son obligatorios.", Toast.LENGTH_LONG).show() @@ -95,6 +90,11 @@ class RegistrarDActivity : AppCompatActivity() { val usuario = Doctor(cedula, nombre, apellido, telefono, domicilio.toInt()) db.agregarDoctores(usuario, contrasena) + historial.eventoRealizado = "Se registraron los datos de un doctor" + historial.fecha = obtenerFecha() + historial.tipoUsuario = "Doctor" + historial.nombreUsuario = nombre + añadirHistorial(historial) Toast.makeText(this@RegistrarDActivity, "USUARIO AGREGADO", Toast.LENGTH_LONG).show() finish() diff --git a/app/src/main/res/drawable/logout.xml b/app/src/main/res/drawable/logout.xml new file mode 100644 index 0000000..8a42cf9 --- /dev/null +++ b/app/src/main/res/drawable/logout.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_paciente_principal.xml b/app/src/main/res/layout/activity_paciente_principal.xml index 86a433f..92e9b0c 100644 --- a/app/src/main/res/layout/activity_paciente_principal.xml +++ b/app/src/main/res/layout/activity_paciente_principal.xml @@ -7,12 +7,20 @@ android:layout_height="match_parent" tools:context=".PacientePrincipalActivity"> + + diff --git a/app/src/main/res/layout/activity_principal.xml b/app/src/main/res/layout/activity_principal.xml index db2ed2c..081ba38 100644 --- a/app/src/main/res/layout/activity_principal.xml +++ b/app/src/main/res/layout/activity_principal.xml @@ -7,22 +7,34 @@ android:orientation="vertical" tools:context="PrincipalActivity"> - + android:layout_height="40dp" + android:orientation="horizontal"> + + + - + android:src="@drawable/doctor"/> diff --git a/app/src/main/res/layout/rc_receta_item.xml b/app/src/main/res/layout/rc_receta_item.xml index d717f76..8cbb8a7 100644 --- a/app/src/main/res/layout/rc_receta_item.xml +++ b/app/src/main/res/layout/rc_receta_item.xml @@ -81,8 +81,8 @@ + app:layout_constraintVertical_bias="0.581" />