Correción Logout ambas pantallas principales

This commit is contained in:
AngelSuarez03 2024-06-02 17:39:59 -06:00
parent 700141d395
commit 828842db37
9 changed files with 76 additions and 26 deletions

View File

@ -3,7 +3,20 @@
<component name="deploymentTargetDropDown">
<value>
<entry key="app">
<State />
<State>
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\USER\.android\avd\Pixel_3a_API_34_extension_level_7_x86_64.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-06-02T23:30:13.381406600Z" />
</State>
</entry>
</value>
</component>

View File

@ -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(

View File

@ -56,6 +56,9 @@ class PacientePrincipalActivity : AppCompatActivity(), CellClickListener {
binding.rvRecetasPaciente.layoutManager=LinearLayoutManager(this)
binding.rvRecetasPaciente.adapter= recycleAdapter
binding.ivLogout.setOnClickListener {
finish()
}
}
override fun onResume() {

View File

@ -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)

View File

@ -30,7 +30,6 @@ class RegistrarDActivity : AppCompatActivity() {
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 {
if (validarCampos()) {
@ -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()

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M17,7L15.59,8.41L18.17,11H8V13H18.17L15.59,15.58L17,17L22,12M4,5H12V3H4C2.9,3 2,3.9 2,5V19C2,20.1 2.9,21 4,21H12V19H4V5Z"/>
</vector>

View File

@ -7,12 +7,20 @@
android:layout_height="match_parent"
tools:context=".PacientePrincipalActivity">
<ImageView
android:id="@+id/iv_logout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="350dp"
android:src="@drawable/logout"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_recetas_paciente"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:layout_below="@id/iv_logout"
tools:listitem="@layout/rc_receta_item" />

View File

@ -7,22 +7,34 @@
android:orientation="vertical"
tools:context="PrincipalActivity">
<TextView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal">
<TextView
android:layout_width="350dp"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:paddingStart="50dp"
android:gravity="center"
android:layout_marginTop="5dp"
android:layout_marginBottom="20dp"
android:textColor="@color/primaryColor"
android:textSize="30dp"/>
<ImageView
android:id="@+id/iv_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:src="@drawable/logout"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<!--<ImageView
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_margin="20dp"
android:src="@drawable/doctor"/>-->
android:src="@drawable/doctor"/>
<GridLayout
android:layout_width="match_parent"
@ -89,7 +101,7 @@
android:layout_height="wrap_content"
android:background="@drawable/radius_tv"
android:backgroundTint="@color/primaryColor"
android:layout_marginTop="80dp"
android:layout_marginTop="130dp"
android:columnCount="3"
android:rowCount="2">

View File

@ -81,8 +81,8 @@
<ImageView
android:id="@+id/iv_correo_receta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginStart="100dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="24dp"
@ -90,10 +90,10 @@
android:background="#3F51B5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.815"
app:layout_constraintHorizontal_bias="0.831"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.529"
app:layout_constraintVertical_bias="0.522"
app:srcCompat="@android:drawable/ic_dialog_email" />
<ImageView
@ -107,7 +107,7 @@
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.593" />
app:layout_constraintVertical_bias="0.581" />
<ImageView
android:id="@+id/iv_eliminar_receta"