From 4d44833c0167df9394078275d00de3333212f685 Mon Sep 17 00:00:00 2001 From: "luis.reyes" Date: Mon, 18 Mar 2024 14:20:19 -0600 Subject: [PATCH] Ajustes en la Pantalla Compra --- app/build.gradle.kts | 2 +- .../com/example/pantallacompra/MyAdapter.kt | 4 ++- .../java/com/example/pantallacompra/compra.kt | 26 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3e45975..724b241 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -47,7 +47,7 @@ dependencies { implementation("com.google.android.material:material:1.11.0") implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("com.google.firebase:firebase-database:20.3.1") - implementation ("com.github.bumptech.glide:glide:4.12.0") + implementation ("com.github.bumptech.glide:glide:4.13.0") annotationProcessor ("com.github.bumptech.glide:compiler:4.12.0") testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.ext:junit:1.1.5") diff --git a/app/src/main/java/com/example/pantallacompra/MyAdapter.kt b/app/src/main/java/com/example/pantallacompra/MyAdapter.kt index 19d1e3e..7697fa8 100644 --- a/app/src/main/java/com/example/pantallacompra/MyAdapter.kt +++ b/app/src/main/java/com/example/pantallacompra/MyAdapter.kt @@ -1,5 +1,6 @@ package com.example.pantallacompra +import android.content.Context import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -8,7 +9,8 @@ import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide -class MyAdapter (private val eventList : ArrayList, private val context: android.content.Context ) : RecyclerView.Adapter(){ + +class MyAdapter (private val eventList : ArrayList, private val context: Context ) : RecyclerView.Adapter(){ private lateinit var mListener : onItemClickListener diff --git a/app/src/main/java/com/example/pantallacompra/compra.kt b/app/src/main/java/com/example/pantallacompra/compra.kt index 2ca06ad..8e750af 100644 --- a/app/src/main/java/com/example/pantallacompra/compra.kt +++ b/app/src/main/java/com/example/pantallacompra/compra.kt @@ -1,11 +1,37 @@ package com.example.pantallacompra +import android.content.Intent import android.os.Bundle +import android.widget.Button +import android.widget.EditText +import android.widget.Toast import androidx.appcompat.app.AppCompatActivity class compra: AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.pantallacompra) + + val btnCancelar: Button = findViewById(R.id.buttonCancelar) + val editTextNombre: EditText = findViewById(R.id.editTextNombre) + val editTextTelefono: EditText = findViewById(R.id.editTextTelefono) + val btnComprar: Button = findViewById(R.id.buttonComprar) + + btnComprar.setOnClickListener { + val nombre = editTextNombre.text.toString() + val telefono = editTextTelefono.text.toString() + + if (nombre.isNotEmpty() && telefono.isNotEmpty()) { + val mensaje = "Nombre: $nombre\nTeléfono: $telefono" + Toast.makeText(this, mensaje, Toast.LENGTH_SHORT).show() + } else { + Toast.makeText(this, "Por favor, ingrese su nombre y número de teléfono", Toast.LENGTH_SHORT).show() + } + } + + btnCancelar.setOnClickListener { + val intent = Intent(this, EventList::class.java) + startActivity(intent) + } } } \ No newline at end of file