diff --git a/app/src/main/java/xyz/danielcortes/androidsqlite/AddProductoActivity.java b/app/src/main/java/xyz/danielcortes/androidsqlite/AddProductoActivity.java
index 823241f..9648ea3 100755
--- a/app/src/main/java/xyz/danielcortes/androidsqlite/AddProductoActivity.java
+++ b/app/src/main/java/xyz/danielcortes/androidsqlite/AddProductoActivity.java
@@ -30,7 +30,7 @@ public class AddProductoActivity extends AppCompatActivity {
grabarButton = findViewById(R.id.grabarButton);
nombreText = findViewById(R.id.nombreText);
cantidadText = findViewById(R.id.cantidadText);
- precioText = findViewById(R.id.precioText);
+ precioText = findViewById(R.id.totalText);
grabarButton.setOnClickListener(onSave());
}
diff --git a/app/src/main/java/xyz/danielcortes/androidsqlite/CustomAdapter.java b/app/src/main/java/xyz/danielcortes/androidsqlite/CustomAdapter.java
index 735ac96..c5862cb 100755
--- a/app/src/main/java/xyz/danielcortes/androidsqlite/CustomAdapter.java
+++ b/app/src/main/java/xyz/danielcortes/androidsqlite/CustomAdapter.java
@@ -7,6 +7,7 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
+import java.text.NumberFormat;
import java.util.List;
public class CustomAdapter extends BaseAdapter {
@@ -48,8 +49,8 @@ public class CustomAdapter extends BaseAdapter {
view = inflater.inflate(R.layout.list_view, null, true);
viewHolder.nombreText = view.findViewById(R.id.nombreText);
viewHolder.cantidadText = view.findViewById(R.id.cantidadText);
- viewHolder.precioText = view.findViewById(R.id.precioText);
viewHolder.totalText = view.findViewById(R.id.totalText);
+ viewHolder.precioText = view.findViewById(R.id.precioText);
view.setTag(viewHolder);
}else{
viewHolder = (ViewHolder)view.getTag();
@@ -57,10 +58,12 @@ public class CustomAdapter extends BaseAdapter {
Producto producto = productos.get(i);
- viewHolder.nombreText.setText("Nombre: " + producto.getNombre());
+ viewHolder.nombreText.setText(producto.getNombre());
viewHolder.cantidadText.setText("Cantidad: " + producto.getCantidad());
- viewHolder.precioText.setText("Precio: " + producto.getPrecio());
- viewHolder.totalText.setText("Total: " + (producto.getPrecio() * producto.getCantidad()));
+
+ NumberFormat formatter = NumberFormat.getCurrencyInstance();
+ viewHolder.precioText.setText(formatter.format(producto.getPrecio()));
+ viewHolder.totalText.setText(formatter.format(producto.getCantidad() * producto.getPrecio()));
return view;
}
diff --git a/app/src/main/java/xyz/danielcortes/androidsqlite/GetAllProductosActivity.java b/app/src/main/java/xyz/danielcortes/androidsqlite/GetAllProductosActivity.java
index b249bb2..74ca0a4 100755
--- a/app/src/main/java/xyz/danielcortes/androidsqlite/GetAllProductosActivity.java
+++ b/app/src/main/java/xyz/danielcortes/androidsqlite/GetAllProductosActivity.java
@@ -5,6 +5,7 @@ import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
+import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
@@ -12,6 +13,7 @@ import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
+import java.text.NumberFormat;
import java.util.List;
public class GetAllProductosActivity extends AppCompatActivity {
@@ -36,7 +38,9 @@ public class GetAllProductosActivity extends AppCompatActivity {
productos = databaseHelper.getAllProductos();
customAdapter = new CustomAdapter(this, productos);
listView.setAdapter(customAdapter);
- totalText.setText("Total: " + databaseHelper.getTotal());
+
+ NumberFormat formatter = NumberFormat.getCurrencyInstance();
+ totalText.setText("Total: " + formatter.format(databaseHelper.getTotal()));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
@@ -62,6 +66,7 @@ public class GetAllProductosActivity extends AppCompatActivity {
productos = databaseHelper.getAllProductos();
customAdapter.changeList(productos);
customAdapter.notifyDataSetChanged();
- totalText.setText("Total: " + databaseHelper.getTotal());
+ NumberFormat formatter = NumberFormat.getCurrencyInstance();
+ totalText.setText("Total: " + formatter.format(databaseHelper.getTotal()));
}
}
diff --git a/app/src/main/java/xyz/danielcortes/androidsqlite/UpdateDeleteActivity.java b/app/src/main/java/xyz/danielcortes/androidsqlite/UpdateDeleteActivity.java
index 2ca612a..7812a88 100755
--- a/app/src/main/java/xyz/danielcortes/androidsqlite/UpdateDeleteActivity.java
+++ b/app/src/main/java/xyz/danielcortes/androidsqlite/UpdateDeleteActivity.java
@@ -34,7 +34,7 @@ public class UpdateDeleteActivity extends AppCompatActivity {
databaseHelper = new DatabaseHelper(this);
nombreText = findViewById(R.id.nombreText);
- precioText = findViewById(R.id.precioText);
+ precioText = findViewById(R.id.totalText);
cantidadText = findViewById(R.id.cantidadText);
updateButton = findViewById(R.id.updateButton);
diff --git a/app/src/main/res/layout/activity_add_producto.xml b/app/src/main/res/layout/activity_add_producto.xml
index ddf9547..150a598 100755
--- a/app/src/main/res/layout/activity_add_producto.xml
+++ b/app/src/main/res/layout/activity_add_producto.xml
@@ -11,42 +11,43 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
- android:layout_marginTop="16dp"
+ android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:ems="10"
android:hint="Nombre"
android:inputType="text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toBottomOf="@+id/textView" />
+ app:layout_constraintTop_toBottomOf="@+id/textView2" />
+ app:layout_constraintTop_toBottomOf="@+id/textView3" />
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_get_all_productos.xml b/app/src/main/res/layout/activity_get_all_productos.xml
index 549160f..760f4a0 100755
--- a/app/src/main/res/layout/activity_get_all_productos.xml
+++ b/app/src/main/res/layout/activity_get_all_productos.xml
@@ -24,6 +24,7 @@
diff --git a/app/src/main/res/layout/activity_update_delete.xml b/app/src/main/res/layout/activity_update_delete.xml
index bac87cc..a3930e1 100755
--- a/app/src/main/res/layout/activity_update_delete.xml
+++ b/app/src/main/res/layout/activity_update_delete.xml
@@ -11,47 +11,48 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
- android:layout_marginTop="16dp"
+ android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:hint="Nombre"
android:inputType="text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toBottomOf="@+id/textView4" />
+ app:layout_constraintTop_toBottomOf="@+id/textView5" />
+ app:layout_constraintTop_toBottomOf="@+id/textView6" />
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/list_view.xml b/app/src/main/res/layout/list_view.xml
index 46650c9..e044cc7 100755
--- a/app/src/main/res/layout/list_view.xml
+++ b/app/src/main/res/layout/list_view.xml
@@ -3,55 +3,55 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:paddingBottom="15dp">
-
-
-
-
+ app:layout_constraintTop_toTopOf="parent"
+ tools:text="Arroz" />
+
+
+ app:layout_constraintTop_toBottomOf="@+id/nombreText"
+ tools:text="Cantidad: 10" />
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 80f09db..a036947 100755
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -16,5 +16,4 @@
-