Skip to content
Snippets Groups Projects
Commit 711972e7 authored by Christian Dresen's avatar Christian Dresen
Browse files

Fix for Product Prices

parent 90d26b49
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,7 @@ public class ProductDialog extends Dialog implements View.OnClickListener { ...@@ -47,6 +47,7 @@ public class ProductDialog extends Dialog implements View.OnClickListener {
String placeholder = "\n\n\n\n\n\n"; String placeholder = "\n\n\n\n\n\n";
placeholder = placeholder.substring(Integer.valueOf(p.getName().length() / 16)); placeholder = placeholder.substring(Integer.valueOf(p.getName().length() / 16));
prodButton.setText(p.getName()+placeholder+String.valueOf(p.getPrice())+" Euro"); prodButton.setText(p.getName()+placeholder+String.valueOf(p.getPrice())+" Euro");
prodButton.setTag(p.getName());
prodButton.setOnClickListener(this); prodButton.setOnClickListener(this);
this.gridProducts.addView(prodButton); this.gridProducts.addView(prodButton);
} }
...@@ -66,7 +67,7 @@ public class ProductDialog extends Dialog implements View.OnClickListener { ...@@ -66,7 +67,7 @@ public class ProductDialog extends Dialog implements View.OnClickListener {
public void onClick(View view) { public void onClick(View view) {
MainManager.getInstance().startTimer(); MainManager.getInstance().startTimer();
Button clicked = (Button) view; Button clicked = (Button) view;
String product_name = (String) clicked.getText(); String product_name = (String) clicked.getTag();
Product product = Product.getOneByName(product_name); Product product = Product.getOneByName(product_name);
Order order = new Order(product); Order order = new Order(product);
UiManager.getInstance().addOrder(order); UiManager.getInstance().addOrder(order);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment