Skip to content

Commit

Permalink
Fixed a bug in quantity feature
Browse files Browse the repository at this point in the history
  • Loading branch information
vidhya committed Aug 3, 2012
1 parent f859d96 commit ea264b3
Show file tree
Hide file tree
Showing 29 changed files with 9 additions and 5 deletions.
Binary file modified out/production/HP/HP.apk.res
Binary file not shown.
Binary file modified out/production/HP/HP.apk.unaligned
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added out/res-cache/HP/drawable-hdpi/quickaction.9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added out/res-cache/HP/drawable-mdpi/ic_menu_goto.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions res/layout/update_quantity.xml
Expand Up @@ -62,8 +62,7 @@
android:layout_width="60px"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:text="1" >
android:inputType="number">
</EditText>

<ImageButton
Expand Down
6 changes: 4 additions & 2 deletions src/com/thoughtworks/hp/activities/AddProductActivity.java
Expand Up @@ -103,10 +103,12 @@ private void initToBuyListView() {
toBuyProductListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
Product product = toBuyProductList.get(position);
Product product= (Product) adapterView.getItemAtPosition(position);
int quantity = shoppingListProductTable.findQuantityOnProductAndShoppingList(shoppingListId, product.getId());
Intent intent = new Intent(AddProductActivity.this, AddQuantityActivity.class);
intent.putExtra("product_id", product.getId());
intent.putExtra("Shopping_list_id", shoppingListId);
intent.putExtra("quantity",quantity);
startActivityForResult(intent, 1);
}
});
Expand All @@ -128,7 +130,7 @@ private void initAutoSuggestListView() {
autoSuggestListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
Product product = autoSuggestedProductList.get(position);
Product product = (Product) adapterView.getItemAtPosition(position);
addAndPersistProductInShoppingList(product);
Intent intent = new Intent(AddProductActivity.this, AddQuantityActivity.class);
intent.putExtra("product_id", product.getId());
Expand Down
5 changes: 4 additions & 1 deletion src/com/thoughtworks/hp/activities/AddQuantityActivity.java
Expand Up @@ -16,6 +16,7 @@ public class AddQuantityActivity extends CustomWindow {

EditText editText;
private long productId;
private int quantity;
@SuppressWarnings("unused")
private long shoppingListId;
private ShoppingListProductTable shoppingListProductTable;
Expand All @@ -29,6 +30,9 @@ public void onCreate(Bundle bundle) {
shoppingListProductTable = new ShoppingListProductTable();
productId = getIntent().getLongExtra("product_id", 1L);
shoppingListId = getIntent().getLongExtra("Shopping_list_id", 0L);
quantity = getIntent().getIntExtra("quantity",1);
editText = (EditText) findViewById(R.id.quantity_value);
editText.setText(String.valueOf(quantity));
boolean availableStatus = ProductAvailabilityService.isProductAvailable(productId);
TextView textToChange = (TextView) findViewById(R.id.availabilityText);
if (!availableStatus) {
Expand All @@ -43,7 +47,6 @@ public void onCreate(Bundle bundle) {
}

private int getValue() {
editText = (EditText) findViewById(R.id.quantity_value);
int quantity = Integer.parseInt(editText.getText().toString());
if (quantity < 0)
quantity = 0;
Expand Down

0 comments on commit ea264b3

Please sign in to comment.