Funcionando con productos y totales :3
This commit is contained in:
4
app/proguard-rules.pro
vendored
4
app/proguard-rules.pro
vendored
@@ -6,7 +6,7 @@
|
|||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
# If your project uses WebView with JS, uncomment the following
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
# and specify the fully qualified class nombre to the JavaScript interface
|
||||||
# class:
|
# class:
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
# public *;
|
# public *;
|
||||||
@@ -17,5 +17,5 @@
|
|||||||
#-keepattributes SourceFile,LineNumberTable
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file nombre.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="xyz.danielcortes.androidsqlite">
|
package="xyz.danielcortes.androidsqlite">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
@@ -8,15 +9,9 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity
|
<activity android:name=".UpdateDeleteActivity" />
|
||||||
android:name=".UpdateDeleteActivity"
|
<activity android:name=".AddProductoActivity" />
|
||||||
android:label="Usuario" />
|
<activity android:name=".GetAllProductosActivity">
|
||||||
<activity
|
|
||||||
android:name=".AddUserActivity"
|
|
||||||
android:label="Ingresar Nombre y Hobby" />
|
|
||||||
<activity
|
|
||||||
android:name=".GetAllUsersActivity"
|
|
||||||
android:label="Usuarios">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package xyz.danielcortes.androidsqlite;
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -10,25 +9,28 @@ import android.widget.Button;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class AddUserActivity extends AppCompatActivity {
|
public class AddProductoActivity extends AppCompatActivity {
|
||||||
private DatabaseHelper databaseHelper;
|
private DatabaseHelper databaseHelper;
|
||||||
|
|
||||||
private Button grabarButton;
|
private Button grabarButton;
|
||||||
private EditText nombreText;
|
private EditText nombreText;
|
||||||
private EditText hobbyText;
|
private EditText precioText;
|
||||||
|
private EditText cantidadText;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_add_user);
|
setContentView(R.layout.activity_add_producto);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
|
getSupportActionBar().setTitle("Agregar Producto");
|
||||||
|
|
||||||
databaseHelper = new DatabaseHelper(this);
|
databaseHelper = new DatabaseHelper(this);
|
||||||
|
|
||||||
grabarButton = findViewById(R.id.grabarButton);
|
grabarButton = findViewById(R.id.grabarButton);
|
||||||
nombreText = findViewById(R.id.nombreText);
|
nombreText = findViewById(R.id.nombreText);
|
||||||
hobbyText = findViewById(R.id.hobbyText);
|
cantidadText = findViewById(R.id.cantidadText);
|
||||||
|
precioText = findViewById(R.id.precioText);
|
||||||
|
|
||||||
grabarButton.setOnClickListener(onSave());
|
grabarButton.setOnClickListener(onSave());
|
||||||
}
|
}
|
||||||
@@ -36,14 +38,13 @@ public class AddUserActivity extends AppCompatActivity {
|
|||||||
private View.OnClickListener onSave() {
|
private View.OnClickListener onSave() {
|
||||||
return new View.OnClickListener() {
|
return new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
databaseHelper.addUserDetail(
|
databaseHelper.addProducto(
|
||||||
nombreText.getText().toString(),
|
nombreText.getText().toString(),
|
||||||
hobbyText.getText().toString()
|
Integer.valueOf(cantidadText.getText().toString()),
|
||||||
|
Integer.valueOf(precioText.getText().toString())
|
||||||
);
|
);
|
||||||
nombreText.setText("");
|
|
||||||
hobbyText.setText("");
|
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
AddUserActivity.this,
|
AddProductoActivity.this,
|
||||||
"Datos grabados!",
|
"Datos grabados!",
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show();
|
).show();
|
||||||
@@ -12,54 +12,60 @@ import java.util.List;
|
|||||||
public class CustomAdapter extends BaseAdapter {
|
public class CustomAdapter extends BaseAdapter {
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private List<User> users;
|
private List<Producto> productos;
|
||||||
|
|
||||||
public CustomAdapter(Context context, List<User> users) {
|
public CustomAdapter(Context context, List<Producto> productos) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.users = users;
|
this.productos = productos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeList(List<User> users) {
|
public void changeList(List<Producto> productos) {
|
||||||
this.users = users;
|
this.productos = productos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return users.size();
|
return productos.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getItem(int i) {
|
public Object getItem(int i) {
|
||||||
return users.get(i);
|
return productos.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int i) {
|
public long getItemId(int i) {
|
||||||
return users.get(i).getId();
|
return productos.get(i).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View view, ViewGroup parent) {
|
public View getView(int i, View view, ViewGroup parent) {
|
||||||
ViewHolder viewHolder;
|
ViewHolder viewHolder;
|
||||||
|
|
||||||
if(view == null) {
|
if(view == null) {
|
||||||
viewHolder = new ViewHolder();
|
viewHolder = new ViewHolder();
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
view = inflater.inflate(R.layout.list_view, null, true);
|
view = inflater.inflate(R.layout.list_view, null, true);
|
||||||
viewHolder.nameText = view.findViewById(R.id.nameText);
|
viewHolder.nombreText = view.findViewById(R.id.nombreText);
|
||||||
viewHolder.hobbyText = view.findViewById(R.id.hobbyText);
|
viewHolder.cantidadText = view.findViewById(R.id.cantidadText);
|
||||||
|
viewHolder.precioText = view.findViewById(R.id.precioText);
|
||||||
|
viewHolder.totalText = view.findViewById(R.id.totalText);
|
||||||
view.setTag(viewHolder);
|
view.setTag(viewHolder);
|
||||||
}else{
|
}else{
|
||||||
viewHolder = (ViewHolder)view.getTag();
|
viewHolder = (ViewHolder)view.getTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
viewHolder.nameText.setText("Nombre: " + users.get(position).getName());
|
Producto producto = productos.get(i);
|
||||||
viewHolder.hobbyText.setText("Hobby: " + users.get(position).getHobby());
|
|
||||||
|
viewHolder.nombreText.setText("Nombre: " + producto.getNombre());
|
||||||
|
viewHolder.cantidadText.setText("Cantidad: " + producto.getCantidad());
|
||||||
|
viewHolder.precioText.setText("Precio: " + producto.getPrecio());
|
||||||
|
viewHolder.totalText.setText("Total: " + (producto.getPrecio() * producto.getCantidad()));
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ViewHolder {
|
private class ViewHolder {
|
||||||
protected TextView nameText, hobbyText;
|
protected TextView nombreText, cantidadText, precioText, totalText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,69 +12,81 @@ import java.util.List;
|
|||||||
|
|
||||||
public class DatabaseHelper extends SQLiteOpenHelper {
|
public class DatabaseHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
public static String DATABASE_NAME = "user_database";
|
|
||||||
private static final int DATABASE_VERSION = 1;
|
|
||||||
private static final String TABLE_USER = "users";
|
|
||||||
private static final String KEY_ID = "id";
|
|
||||||
private static final String KEY_FIRSTNAME = "name";
|
|
||||||
private static final String KEY_HOBBY = "hobby";
|
|
||||||
|
|
||||||
private static final String CREATE_TABLE_STUDENTS = "CREATE TABLE " + TABLE_USER + "(" + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_FIRSTNAME + " TEXT, " + KEY_HOBBY + " TEXT );";
|
|
||||||
|
|
||||||
public DatabaseHelper(Context context) {
|
public DatabaseHelper(Context context) {
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
super(context, "productos_db", null, 1);
|
||||||
|
|
||||||
Log.d("Database", CREATE_TABLE_STUDENTS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(SQLiteDatabase db) {
|
public void onCreate(SQLiteDatabase db) {
|
||||||
db.execSQL(CREATE_TABLE_STUDENTS);
|
String sql = new StringBuilder()
|
||||||
|
.append("create table producto (")
|
||||||
|
.append("id integer primary key autoincrement,")
|
||||||
|
.append("nombre text not null,")
|
||||||
|
.append("cantidad integer not null default 1,")
|
||||||
|
.append("precio integer not null default 1)")
|
||||||
|
.toString();
|
||||||
|
db.execSQL(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
db.execSQL("DROP TABLE IF EXISTS '" + TABLE_USER + "'");
|
db.execSQL("drop table if exists producto");
|
||||||
onCreate(db);
|
onCreate(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addUserDetail(String name, String hobby) {
|
public boolean addProducto(String nombre, int cantidad, int precio) {
|
||||||
SQLiteDatabase db = this.getWritableDatabase();
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(KEY_FIRSTNAME, name);
|
values.put("nombre", nombre);
|
||||||
values.put(KEY_HOBBY, hobby);
|
values.put("cantidad", cantidad);
|
||||||
return db.insert(TABLE_USER, null, values) == 1;
|
values.put("precio", precio);
|
||||||
|
return db.insert("producto", null, values) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<User> getAllUsers() {
|
public List<Producto> getAllProductos() {
|
||||||
List<User> users= new ArrayList<>();
|
List<Producto> productos = new ArrayList<>();
|
||||||
String selectQuery = "SELECT * FROM " + TABLE_USER;
|
|
||||||
|
String sql = "select * from producto";
|
||||||
SQLiteDatabase db = this.getReadableDatabase();
|
SQLiteDatabase db = this.getReadableDatabase();
|
||||||
Cursor cursor = db.rawQuery(selectQuery, null);
|
Cursor cursor = db.rawQuery(sql, null);
|
||||||
|
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
User user = new User();
|
Producto producto = new Producto();
|
||||||
user.setId(cursor.getInt(cursor.getColumnIndex(KEY_ID)));
|
producto.setId(cursor.getInt(cursor.getColumnIndex("id")));
|
||||||
user.setName(cursor.getString(cursor.getColumnIndex(KEY_FIRSTNAME)));
|
producto.setNombre(cursor.getString(cursor.getColumnIndex("nombre")));
|
||||||
user.setHobby(cursor.getString(cursor.getColumnIndex(KEY_HOBBY)));
|
producto.setCantidad(cursor.getInt(cursor.getColumnIndex("cantidad")));
|
||||||
users.add(user);
|
producto.setPrecio(cursor.getInt(cursor.getColumnIndex("precio")));
|
||||||
|
productos.add(producto);
|
||||||
} while (cursor.moveToNext());
|
} while (cursor.moveToNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor.close();
|
cursor.close();
|
||||||
return users;
|
return productos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int updateUser(int id, String name, String hobby) {
|
public long getTotal() {
|
||||||
|
String sql = "select sum(precio * cantidad) as total from producto";
|
||||||
|
SQLiteDatabase db = this.getReadableDatabase();
|
||||||
|
Cursor cursor = db.rawQuery(sql, null);
|
||||||
|
if(cursor.moveToFirst()) {
|
||||||
|
return cursor.getLong(cursor.getColumnIndex("total"));
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updateProducto(int id, String name, int cantidad, int precio) {
|
||||||
SQLiteDatabase db = this.getWritableDatabase();
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(KEY_FIRSTNAME, name);
|
values.put("nombre", name);
|
||||||
values.put(KEY_HOBBY, hobby);
|
values.put("cantidad", cantidad);
|
||||||
return db.update(TABLE_USER, values, KEY_ID + " = ?", new String[]{String.valueOf(id)});
|
values.put("precio", precio);
|
||||||
|
return db.update("producto", values, "id = ?", new String[]{String.valueOf(id)});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteUser(int id) {
|
public void deleteProducto(int id) {
|
||||||
SQLiteDatabase db = this.getWritableDatabase();
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
db.delete(TABLE_USER, KEY_ID + " = ?", new String[]{String.valueOf(id)});
|
db.delete("producto", "id = ?", new String[]{String.valueOf(id)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,45 +3,46 @@ package xyz.danielcortes.androidsqlite;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GetAllUsersActivity extends AppCompatActivity {
|
public class GetAllProductosActivity extends AppCompatActivity {
|
||||||
private ListView listView;
|
private ListView listView;
|
||||||
private Button agregarButton;
|
private Button agregarButton;
|
||||||
private List<User> users;
|
private TextView totalText;
|
||||||
|
private List<Producto> productos;
|
||||||
private CustomAdapter customAdapter;
|
private CustomAdapter customAdapter;
|
||||||
private DatabaseHelper databaseHelper;
|
private DatabaseHelper databaseHelper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_get_all_users);
|
setContentView(R.layout.activity_get_all_productos);
|
||||||
|
getSupportActionBar().setTitle("Lista de compra");
|
||||||
|
|
||||||
listView = findViewById(R.id.listView);
|
listView = findViewById(R.id.listView);
|
||||||
|
totalText = findViewById(R.id.totalText);
|
||||||
agregarButton = findViewById(R.id.agregarButton);
|
agregarButton = findViewById(R.id.agregarButton);
|
||||||
|
|
||||||
databaseHelper = new DatabaseHelper(this);
|
databaseHelper = new DatabaseHelper(this);
|
||||||
users = databaseHelper.getAllUsers();
|
productos = databaseHelper.getAllProductos();
|
||||||
customAdapter = new CustomAdapter(this, users);
|
customAdapter = new CustomAdapter(this, productos);
|
||||||
listView.setAdapter(customAdapter);
|
listView.setAdapter(customAdapter);
|
||||||
|
totalText.setText("Total: " + databaseHelper.getTotal());
|
||||||
|
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
Intent intent = new Intent(GetAllUsersActivity.this, UpdateDeleteActivity.class);
|
Intent intent = new Intent(GetAllProductosActivity.this, UpdateDeleteActivity.class);
|
||||||
intent.putExtra("user", users.get(position));
|
intent.putExtra("producto", productos.get(position));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -49,7 +50,7 @@ public class GetAllUsersActivity extends AppCompatActivity {
|
|||||||
agregarButton.setOnClickListener(new View.OnClickListener() {
|
agregarButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(GetAllUsersActivity.this, AddUserActivity.class);
|
Intent intent = new Intent(GetAllProductosActivity.this, AddProductoActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -58,8 +59,9 @@ public class GetAllUsersActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
users = databaseHelper.getAllUsers();
|
productos = databaseHelper.getAllProductos();
|
||||||
customAdapter.changeList(users);
|
customAdapter.changeList(productos);
|
||||||
customAdapter.notifyDataSetChanged();
|
customAdapter.notifyDataSetChanged();
|
||||||
|
totalText.setText("Total: " + databaseHelper.getTotal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
42
app/src/main/java/xyz/danielcortes/androidsqlite/Producto.java
Executable file
42
app/src/main/java/xyz/danielcortes/androidsqlite/Producto.java
Executable file
@@ -0,0 +1,42 @@
|
|||||||
|
package xyz.danielcortes.androidsqlite;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Producto implements Serializable {
|
||||||
|
private int id;
|
||||||
|
private String nombre;
|
||||||
|
private int cantidad;
|
||||||
|
private int precio;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNombre() {
|
||||||
|
return nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNombre(String nombre) {
|
||||||
|
this.nombre = nombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCantidad() {
|
||||||
|
return cantidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCantidad(int cantidad) {
|
||||||
|
this.cantidad = cantidad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPrecio() {
|
||||||
|
return precio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrecio(int precio) {
|
||||||
|
this.precio = precio;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -13,9 +12,11 @@ import android.widget.EditText;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class UpdateDeleteActivity extends AppCompatActivity {
|
public class UpdateDeleteActivity extends AppCompatActivity {
|
||||||
private User user;
|
private Producto producto;
|
||||||
private EditText nombreText;
|
private EditText nombreText;
|
||||||
private EditText hobbyText;
|
private EditText precioText;
|
||||||
|
private EditText cantidadText;
|
||||||
|
|
||||||
private Button updateButton;
|
private Button updateButton;
|
||||||
private Button deleteButton;
|
private Button deleteButton;
|
||||||
|
|
||||||
@@ -27,17 +28,21 @@ public class UpdateDeleteActivity extends AppCompatActivity {
|
|||||||
setContentView(R.layout.activity_update_delete);
|
setContentView(R.layout.activity_update_delete);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
|
getSupportActionBar().setTitle("Modificar Producto");
|
||||||
|
|
||||||
user = (User) getIntent().getSerializableExtra("user");
|
producto = (Producto) getIntent().getSerializableExtra("producto");
|
||||||
databaseHelper = new DatabaseHelper(this);
|
databaseHelper = new DatabaseHelper(this);
|
||||||
|
|
||||||
nombreText = findViewById(R.id.nameText);
|
nombreText = findViewById(R.id.nombreText);
|
||||||
hobbyText = findViewById(R.id.hobbyText);
|
precioText = findViewById(R.id.precioText);
|
||||||
|
cantidadText = findViewById(R.id.cantidadText);
|
||||||
|
|
||||||
updateButton = findViewById(R.id.updateButton);
|
updateButton = findViewById(R.id.updateButton);
|
||||||
deleteButton = findViewById(R.id.deleteButton);
|
deleteButton = findViewById(R.id.deleteButton);
|
||||||
|
|
||||||
nombreText.setText(user.getName());
|
nombreText.setText(producto.getNombre());
|
||||||
hobbyText.setText(user.getHobby());
|
precioText.setText(String.valueOf(producto.getPrecio()));
|
||||||
|
cantidadText.setText(String.valueOf(producto.getCantidad()));
|
||||||
|
|
||||||
updateButton.setOnClickListener(onUpdate());
|
updateButton.setOnClickListener(onUpdate());
|
||||||
deleteButton.setOnClickListener(onDelete());
|
deleteButton.setOnClickListener(onDelete());
|
||||||
@@ -52,7 +57,7 @@ public class UpdateDeleteActivity extends AppCompatActivity {
|
|||||||
.setPositiveButton("Si", new DialogInterface.OnClickListener() {
|
.setPositiveButton("Si", new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
databaseHelper.deleteUser(user.getId());
|
databaseHelper.deleteProducto(producto.getId());
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
UpdateDeleteActivity.this,
|
UpdateDeleteActivity.this,
|
||||||
"Usuario eliminado correctamente",
|
"Usuario eliminado correctamente",
|
||||||
@@ -72,8 +77,9 @@ public class UpdateDeleteActivity extends AppCompatActivity {
|
|||||||
return new View.OnClickListener() {
|
return new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (user.getName().equals(nombreText.getText().toString()) &&
|
if (producto.getNombre().equals(nombreText.getText().toString()) &&
|
||||||
user.getHobby().equals(hobbyText.getText().toString())
|
String.valueOf(producto.getPrecio()).equals(precioText.getText().toString()) &&
|
||||||
|
String.valueOf(producto.getCantidad()).equals(cantidadText.getText().toString())
|
||||||
) {
|
) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
UpdateDeleteActivity.this,
|
UpdateDeleteActivity.this,
|
||||||
@@ -83,21 +89,19 @@ public class UpdateDeleteActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
databaseHelper.updateUser(
|
databaseHelper.updateProducto(
|
||||||
user.getId(),
|
producto.getId(),
|
||||||
nombreText.getText().toString(),
|
nombreText.getText().toString(),
|
||||||
hobbyText.getText().toString()
|
Integer.valueOf(cantidadText.getText().toString()),
|
||||||
|
Integer.valueOf(precioText.getText().toString())
|
||||||
);
|
);
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
UpdateDeleteActivity.this,
|
UpdateDeleteActivity.this,
|
||||||
"ACTUALIZACIÓN EXITOSA!",
|
"Actualización realizada!",
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show();
|
).show();
|
||||||
|
|
||||||
Intent intent = new Intent(UpdateDeleteActivity.this, AddUserActivity.class);
|
finish();
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
package xyz.danielcortes.androidsqlite;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
public class User implements Serializable {
|
|
||||||
private int id;
|
|
||||||
private String name;
|
|
||||||
private String hobby;
|
|
||||||
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHobby() {
|
|
||||||
return hobby;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHobby(String hobby) {
|
|
||||||
this.hobby = hobby;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".AddUserActivity">
|
tools:context=".AddProductoActivity">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/nombreText"
|
android:id="@+id/nombreText"
|
||||||
@@ -15,25 +15,39 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Nombre"
|
android:hint="Nombre"
|
||||||
android:inputType="none"
|
android:inputType="text"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/hobbyText"
|
android:id="@+id/precioText"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Hobby"
|
android:hint="Precio"
|
||||||
android:inputType="none"
|
android:inputType="numberSigned|number"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/nombreText" />
|
app:layout_constraintTop_toBottomOf="@+id/nombreText" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/cantidadText"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Cantidad"
|
||||||
|
android:inputType="numberSigned|number"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/precioText" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/grabarButton"
|
android:id="@+id/grabarButton"
|
||||||
style="@android:style/Widget.Material.Button.Colored"
|
style="@android:style/Widget.Material.Button.Colored"
|
||||||
@@ -44,7 +58,8 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:text="Grabar"
|
android:text="Grabar"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/hobbyText" />
|
app:layout_constraintTop_toBottomOf="@+id/cantidadText" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -2,10 +2,9 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/linearLayout2"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".GetAllUsersActivity">
|
tools:context=".GetAllProductosActivity">
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/listView"
|
android:id="@+id/listView"
|
||||||
@@ -15,8 +14,9 @@
|
|||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/agregarButton"
|
app:layout_constraintBottom_toTopOf="@+id/totalText"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
@@ -32,6 +32,18 @@
|
|||||||
android:text="Agregar"
|
android:text="Agregar"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/totalText"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/agregarButton"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -7,28 +7,44 @@
|
|||||||
tools:context=".UpdateDeleteActivity">
|
tools:context=".UpdateDeleteActivity">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/nameText"
|
android:id="@+id/nombreText"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:hint="Nombre"
|
android:hint="Nombre"
|
||||||
|
android:inputType="text"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/hobbyText"
|
android:id="@+id/precioText"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:hint="Hobby"
|
android:hint="Precio"
|
||||||
|
android:inputType="numberSigned|number"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/nameText" />
|
app:layout_constraintTop_toBottomOf="@+id/nombreText" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/cantidadText"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:hint="Cantidad"
|
||||||
|
android:inputType="numberSigned"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/precioText" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/updateButton"
|
android:id="@+id/updateButton"
|
||||||
@@ -39,18 +55,20 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:text="Actualizar"
|
android:text="Actualizar"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/hobbyText" />
|
app:layout_constraintTop_toBottomOf="@+id/cantidadText" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/deleteButton"
|
android:id="@+id/deleteButton"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="12dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:text="Borrar"
|
android:text="Borrar"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/updateButton" />
|
app:layout_constraintTop_toBottomOf="@+id/updateButton" />
|
||||||
|
|
||||||
|
|||||||
@@ -2,35 +2,56 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/linearLayout"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/nameText"
|
android:id="@+id/nombreText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:text="TextView"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/hobbyText"
|
android:id="@+id/precioText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:text="TextView"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/nameText" />
|
app:layout_constraintTop_toBottomOf="@+id/nombreText" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/cantidadText"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/precioText" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/totalText"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/cantidadText" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">AndroidSQLite</string>
|
<string name="app_name">Lista de Compra</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Project-wide Gradle settings.
|
# Project-wide Gradle settings.
|
||||||
# IDE (e.g. Android Studio) users:
|
# IDE (e.g. Android Studio) productos:
|
||||||
# Gradle settings configured through the IDE *will override*
|
# Gradle settings configured through the IDE *will override*
|
||||||
# any settings specified in this file.
|
# any settings specified in this file.
|
||||||
# For more details on how to configure your build environment visit
|
# For more details on how to configure your build environment visit
|
||||||
|
|||||||
4
gradlew
vendored
4
gradlew
vendored
@@ -106,7 +106,7 @@ fi
|
|||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
if $darwin; then
|
if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:nombre=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
@@ -123,7 +123,7 @@ if $cygwin ; then
|
|||||||
SEP="|"
|
SEP="|"
|
||||||
done
|
done
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
# Add a producto-defined pattern to the cygpath arguments
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user