Guest User

Untitled

a guest
Jun 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <string name="total_coffee_cost">You ordered %1$d cups of coffee. nPrepare to pay $%2$d. nThank you!</string>
  2. <string name="total_coffee_cost_zero">You have not ordered any cup of coffee. nTry to choose again. nThank you!</string>
  3.  
  4. private TextView createOrderSummary(View view){
  5. CheckBox whippedCreamCheckBox = findViewById(R.id.whipped_cream_checkbox);
  6. hasWhippedCream = whippedCreamCheckBox.isChecked();
  7.  
  8. CheckBox chocolateCheckBox = findViewById(R.id.chocolate_checkbox);
  9. hasChocolate = chocolateCheckBox.isChecked();
  10.  
  11. TextView priceMessage = findViewById(R.id.price_text_view);
  12. if (numberOfCoffees == 0)
  13. priceMessage.setText(getString(R.string.total_coffee_cost_zero));
  14. ....
  15. else if ((numberOfCoffees > 1) && (!hasWhippedCream) && (!hasChocolate))
  16. priceMessage.setText(getString(R.string.total_coffee_cost, numberOfCoffees, numberOfCoffees * priceOfCup));
  17. ....
  18. return priceMessage;
  19. }
  20.  
  21. <string name="total_coffee_cost">Hi, %1$s! You ordered %2$d cups of coffee. nPrepare to pay $%3$d. nThank you!</string>
Add Comment
Please, Sign In to add comment