From 4f693a95e046e37d9c7f42ce66a11243bc320640 Mon Sep 17 00:00:00 2001 From: mosterTeco Date: Sat, 11 May 2024 17:11:06 -0600 Subject: [PATCH] Funcionalidad botones de cancelar --- .../com/terratenientes/medicalhealth/EliminarActivity.kt | 7 +++++++ .../medicalhealth/EliminarRecetaActivity.kt | 8 ++++++++ app/src/main/res/layout/activity_eliminar_paciente.xml | 1 + app/src/main/res/layout/activity_eliminar_receta.xml | 1 + 4 files changed, 17 insertions(+) diff --git a/app/src/main/java/com/terratenientes/medicalhealth/EliminarActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/EliminarActivity.kt index e8d58ef..e35e3ae 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/EliminarActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/EliminarActivity.kt @@ -4,6 +4,7 @@ import adapters.DoctorDataBaseHelper import adapters.PacienteAdapter import data.Paciente import android.annotation.SuppressLint +import android.content.Intent import android.os.Bundle import android.widget.Toast import androidx.appcompat.app.AppCompatActivity @@ -38,6 +39,12 @@ class EliminarActivity : AppCompatActivity() { Toast.makeText(this, "Por favor, selecciona un paciente para eliminar.", Toast.LENGTH_SHORT).show() } } + + binding.btnCancelar.setOnClickListener { + val intent = Intent(this@EliminarActivity, PrincipalActivity::class.java) + startActivity(intent) + finish() + } } private fun cargarListaPacientes() { diff --git a/app/src/main/java/com/terratenientes/medicalhealth/EliminarRecetaActivity.kt b/app/src/main/java/com/terratenientes/medicalhealth/EliminarRecetaActivity.kt index 90a746b..02738c2 100644 --- a/app/src/main/java/com/terratenientes/medicalhealth/EliminarRecetaActivity.kt +++ b/app/src/main/java/com/terratenientes/medicalhealth/EliminarRecetaActivity.kt @@ -2,6 +2,7 @@ package com.terratenientes.medicalhealth import adapters.RecetaAdapter import adapters.RecetaDataBaseHelper +import android.content.Intent import data.Receta import android.os.Bundle import android.widget.Toast @@ -39,6 +40,13 @@ class EliminarRecetaActivity : AppCompatActivity() { Toast.makeText(this, "Por favor, seleccione una receta para eliminar", Toast.LENGTH_SHORT).show() } } + + binding.btnCancelarr.setOnClickListener { + val intent = Intent(this@EliminarRecetaActivity, PrincipalActivity::class.java) + startActivity(intent) + finish() + } + } private fun cargarListaRecetas() { diff --git a/app/src/main/res/layout/activity_eliminar_paciente.xml b/app/src/main/res/layout/activity_eliminar_paciente.xml index 1b0ccb3..ffdd6e3 100644 --- a/app/src/main/res/layout/activity_eliminar_paciente.xml +++ b/app/src/main/res/layout/activity_eliminar_paciente.xml @@ -40,6 +40,7 @@ android:text="@string/bt_eliminar" />