예제 #1
0
 public void subOne(View view) {
   if (coffeeNumber != 0) {
     Log.d(TAG, "Subtracting one");
     coffeeNumber--;
   } else {
     Log.d(TAG, "Can't subtract, already a at 0");
   }
   findMyPrice.displayAll(coffeeNumber, cost);
 }
예제 #2
0
 /** This method is called when the order button is clicked. */
 public void submitOrder(View view) {
   Log.d(TAG, "Your order has been submitted!");
   // Toast.makeText(getApplicationContext(), "Your order has been successfully submitted!",
   // Toast.LENGTH_SHORT).show();
   int finalPrice = findMyPrice.calcPrice(coffeeNumber, cost);
   Intent intent = new Intent(this, OrderActivity.class);
   intent.putExtra("milkBool", milk);
   intent.putExtra("creamBool", cream);
   intent.putExtra("sugarBool", sugar);
   intent.putExtra("displayValue", finalPrice);
   intent.putExtra("coffeeCount", coffeeNumber);
   startActivity(intent);
 }
예제 #3
0
  public void reset(View view) {

    coffeeNumber = 0;
    findMyPrice.displayAll(coffeeNumber, cost);
    TextView priceView = (TextView) findViewById(R.id.price_text_view);
    CheckBox milkBox = (CheckBox) findViewById(R.id.milkBox);
    CheckBox creamBox = (CheckBox) findViewById(R.id.creamBox);
    CheckBox sugarBox = (CheckBox) findViewById(R.id.sugarBox);
    if (milkBox.isChecked()) {
      milkBox.toggle();
    }

    if (creamBox.isChecked()) {
      creamBox.toggle();
    }

    if (sugarBox.isChecked()) {
      sugarBox.toggle();
    }

    priceView.setText("");
  }
예제 #4
0
 public void addOne(View view) {
   Log.d(TAG, "Adding one");
   coffeeNumber++;
   findMyPrice.displayAll(coffeeNumber, cost);
 }