Commit 403e83b4 authored by jordan.dalby's avatar jordan.dalby

Fixed enter amount problem related to currency

parent 6708c96f
...@@ -98,7 +98,7 @@ public class BookPayment extends AppCompatActivity implements TextWatcher ...@@ -98,7 +98,7 @@ public class BookPayment extends AppCompatActivity implements TextWatcher
Locale locale = getResources().getConfiguration().getLocales().get(0); Locale locale = getResources().getConfiguration().getLocales().get(0);
String currencySymbol = NumberFormat.getCurrencyInstance(locale).getCurrency().getCurrencyCode(); String currencySymbol = NumberFormat.getCurrencyInstance(locale).getCurrency().getSymbol();
String clean = s.toString().replaceAll("[" + currencySymbol + ",.]", ""); String clean = s.toString().replaceAll("[" + currencySymbol + ",.]", "");
...@@ -147,7 +147,7 @@ public class BookPayment extends AppCompatActivity implements TextWatcher ...@@ -147,7 +147,7 @@ public class BookPayment extends AppCompatActivity implements TextWatcher
if (amt == 0) if (amt == 0)
continue; continue;
nameBuilder.append(item.displayName + "\n"); nameBuilder.append(getString(item.displayName) + "\n");
quantityBuilder.append(String.valueOf(amt) + "\n"); quantityBuilder.append(String.valueOf(amt) + "\n");
costBuilder.append(NumberFormat.getCurrencyInstance(locale).format(item.cost * amt) + "\n"); costBuilder.append(NumberFormat.getCurrencyInstance(locale).format(item.cost * amt) + "\n");
b = true; b = true;
...@@ -168,7 +168,7 @@ public class BookPayment extends AppCompatActivity implements TextWatcher ...@@ -168,7 +168,7 @@ public class BookPayment extends AppCompatActivity implements TextWatcher
continue; continue;
b = true; b = true;
nameBuilder.append(item.displayName + "\n"); nameBuilder.append(getString(item.displayName) + "\n");
quantityBuilder.append(String.valueOf(amt) + "\n"); quantityBuilder.append(String.valueOf(amt) + "\n");
costBuilder.append(NumberFormat.getCurrencyInstance(locale).format(item.cost * amt) + "\n"); costBuilder.append(NumberFormat.getCurrencyInstance(locale).format(item.cost * amt) + "\n");
} }
...@@ -220,9 +220,9 @@ public class BookPayment extends AppCompatActivity implements TextWatcher ...@@ -220,9 +220,9 @@ public class BookPayment extends AppCompatActivity implements TextWatcher
enterAmount.removeTextChangedListener(this); enterAmount.removeTextChangedListener(this);
Locale locale = getResources().getConfiguration().getLocales().get(0); Locale locale = getResources().getConfiguration().getLocales().get(0);
String currency = NumberFormat.getCurrencyInstance(locale).getCurrency().getCurrencyCode(); String currency = NumberFormat.getCurrencyInstance(locale).getCurrency().getSymbol();
String clean = s.toString().replaceAll("[" + currency + ",.]", ""); String clean = s.toString().replaceAll("[" + currency + ",.]", ""); // TODO: Fix this
double parsed = Double.parseDouble(clean); double parsed = Double.parseDouble(clean);
String formatted = NumberFormat.getCurrencyInstance(locale).format((parsed / 100)); String formatted = NumberFormat.getCurrencyInstance(locale).format((parsed / 100));
......
...@@ -106,7 +106,7 @@ public class BookSouvenir extends AppCompatActivity ...@@ -106,7 +106,7 @@ public class BookSouvenir extends AppCompatActivity
String s = "\t\t" + getString(R.string.cafeTotal) + " \t\t\t\t" + NumberFormat.getCurrencyInstance(locale).format(bookPacket.cafe.getTotal()) + String s = "\t\t" + getString(R.string.cafeTotal) + " \t\t\t\t" + NumberFormat.getCurrencyInstance(locale).format(bookPacket.cafe.getTotal()) +
"\n+\t" + getString(R.string.souvenirTotal) + " \t" + NumberFormat.getCurrencyInstance(locale).format(bookPacket.souvenir.getTotal()) + "\n+\t" + getString(R.string.souvenirTotal) + " \t" + NumberFormat.getCurrencyInstance(locale).format(bookPacket.souvenir.getTotal()) +
"\n+\t" + getString(R.string.entranceFee) + " \t\t" + NumberFormat.getCurrencyInstance(locale).format(bookPacket.museumPacket.entranceFee) + "\n+\t" + getString(R.string.entranceFee) + " \t\t" + NumberFormat.getCurrencyInstance(locale).format(bookPacket.museumPacket.entranceFee) +
"\n=\t" + getString(R.string.cafeTotal) + " \t\t\t\t\t\t\t\t\t" + NumberFormat.getCurrencyInstance(locale).format((bookPacket.souvenir.getTotal() + bookPacket.museumPacket.entranceFee)); "\n=\t" + getString(R.string.total) + " \t\t\t\t\t\t\t\t\t" + NumberFormat.getCurrencyInstance(locale).format((bookPacket.souvenir.getTotal() + bookPacket.museumPacket.entranceFee));
subtotal.setText(s); subtotal.setText(s);
} }
......
...@@ -312,7 +312,7 @@ ...@@ -312,7 +312,7 @@
android:id="@+id/snowglobeName" android:id="@+id/snowglobeName"
android:layout_width="92dp" android:layout_width="92dp"
android:layout_height="22dp" android:layout_height="22dp"
android:layout_marginStart="252dp" android:layout_marginStart="240dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/snowglobe" android:text="@string/snowglobe"
android:textAlignment="center" android:textAlignment="center"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment