Ajustes en la Pantalla Compra

This commit is contained in:
luis.reyes 2024-03-18 14:20:19 -06:00
parent 395e5e65dd
commit 4d44833c01
3 changed files with 30 additions and 2 deletions

View File

@ -47,7 +47,7 @@ dependencies {
implementation("com.google.android.material:material:1.11.0") implementation("com.google.android.material:material:1.11.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("com.google.firebase:firebase-database:20.3.1") 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") annotationProcessor ("com.github.bumptech.glide:compiler:4.12.0")
testImplementation("junit:junit:4.13.2") testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation("androidx.test.ext:junit:1.1.5")

View File

@ -1,5 +1,6 @@
package com.example.pantallacompra package com.example.pantallacompra
import android.content.Context
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -8,7 +9,8 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
class MyAdapter (private val eventList : ArrayList<Event>, private val context: android.content.Context ) : RecyclerView.Adapter<MyAdapter.MyViewHolder>(){
class MyAdapter (private val eventList : ArrayList<Event>, private val context: Context ) : RecyclerView.Adapter<MyAdapter.MyViewHolder>(){
private lateinit var mListener : onItemClickListener private lateinit var mListener : onItemClickListener

View File

@ -1,11 +1,37 @@
package com.example.pantallacompra package com.example.pantallacompra
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
class compra: AppCompatActivity() { class compra: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.pantallacompra) 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)
}
} }
} }