diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e775d1a..0d569b5 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,6 +1,7 @@
+ package="net.thauvin.erik.android.tiproid" android:installLocation="auto"
+ android:versionName="0.4" android:versionCode="4">
@@ -9,4 +10,5 @@
+
\ No newline at end of file
diff --git a/default.properties b/default.properties
new file mode 100644
index 0000000..c5d5335
--- /dev/null
+++ b/default.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Indicates whether an apk should be generated for each density.
+split.density=false
+# Project target.
+target=android-8
+apk-configurations=
diff --git a/src/net/thauvin/erik/android/tiproid/R.java b/gen/net/thauvin/erik/android/tiproid/R.java
similarity index 97%
rename from src/net/thauvin/erik/android/tiproid/R.java
rename to gen/net/thauvin/erik/android/tiproid/R.java
index cbfe4f6..4f11c10 100644
--- a/src/net/thauvin/erik/android/tiproid/R.java
+++ b/gen/net/thauvin/erik/android/tiproid/R.java
@@ -70,6 +70,7 @@ public final class R {
public static final int alert_dialog_ok=0x7f050003;
public static final int app_name=0x7f050000;
public static final int error_bill_txt=0x7f050010;
+ public static final int error_identical_txt=0x7f050011;
public static final int main_bill_lbl_txt=0x7f050005;
public static final int main_calc_btn_txt=0x7f050006;
public static final int main_reset_btn_txt=0x7f050007;
@@ -81,6 +82,6 @@ public final class R {
public static final int result_split_lbl_txt=0x7f05000e;
public static final int result_tip_lbl_txt=0x7f05000d;
public static final int result_total_lbl_txt=0x7f05000f;
- public static final int sample_txt=0x7f050011;
+ public static final int sample_txt=0x7f050012;
}
}
diff --git a/res/layout/calc.xml b/res/layout/calc.xml
index b0cda15..b7a0dd2 100644
--- a/res/layout/calc.xml
+++ b/res/layout/calc.xml
@@ -1,55 +1,48 @@
-
+ android:orientation="vertical" android:layout_height="wrap_content"
+ android:layout_width="wrap_content" android:paddingLeft="10dip"
+ android:paddingRight="10dip">
+
-
-
-
-
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="wrap_content" android:layout_width="wrap_content">
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/res/layout/main.xml b/res/layout/main.xml
index 907c845..3d56b5d 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -6,14 +6,13 @@
android:layout_width="wrap_content" android:layout_marginRight="20dip"
android:text="@string/main_tax_lbl_txt" android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:id="@+id/main_tax_lbl" android:layout_marginLeft="20dip" />
+ android:id="@+id/main_tax_lbl" android:layout_marginLeft="20dip" android:textSize="15px"/>
+ android:layout_gravity="center_vertical" android:gravity="right" android:id="@+id/main_tax_fld"
+ android:layout_width="wrap_content" android:minWidth="200dip" android:numeric="decimal"/>
@@ -22,14 +21,13 @@
android:layout_width="wrap_content" android:layout_marginRight="20dip"
android:text="@string/main_bill_lbl_txt" android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:id="@+id/main_bill_lbl" android:layout_marginLeft="20dip" />
+ android:id="@+id/main_bill_lbl" android:layout_marginLeft="20dip" android:textSize="15px"/>
+ android:layout_gravity="center_vertical" android:gravity="right" android:id="@+id/main_bill_fld"
+ android:layout_width="wrap_content" android:minWidth="200dip" android:numeric="decimal"/>
@@ -43,11 +41,11 @@
android:layout_width="wrap_content" android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/main_tip_lbl" android:text="@string/main_tip_lbl_txt"
- android:minWidth="200dip" />
+ android:minWidth="200dip" android:textSize="15px"/>
+ android:id="@+id/main_tip_lbl" android:text="@string/main_split_lbl_txt" android:textSize="15px"/>
+ android:id="@+id/main_calculate_btn">
+ android:id="@+id/main_reset_btn">
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d503695..d693b3d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,7 +1,7 @@
Tiproid
- © 2008 Erik C. Thauvin\nAll Rights Reserved\n\nerik@thauvin.net\n\nhttp://mobile.thauvin.net
+ © 2008-10 Erik C. Thauvin\nAll Rights Reserved\n\nerik@thauvin.net\n\nhttp://mobile.thauvin.net/
About
OK
Cancel
@@ -16,6 +16,7 @@
Tip ?%:
Split x ?:
Total:
- Please enter the bill amount...
+ Please enter the bill amount!
+ Amounts should not be identical!
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
diff --git a/screenshots/0.3/1.png b/screenshots/0.3/1.png
new file mode 100644
index 0000000..5496d08
Binary files /dev/null and b/screenshots/0.3/1.png differ
diff --git a/screenshots/0.3/1.psd b/screenshots/0.3/1.psd
new file mode 100644
index 0000000..7cc83c8
Binary files /dev/null and b/screenshots/0.3/1.psd differ
diff --git a/screenshots/0.3/2.png b/screenshots/0.3/2.png
new file mode 100644
index 0000000..8a9b572
Binary files /dev/null and b/screenshots/0.3/2.png differ
diff --git a/screenshots/0.3/2.psd b/screenshots/0.3/2.psd
new file mode 100644
index 0000000..8d51cee
Binary files /dev/null and b/screenshots/0.3/2.psd differ
diff --git a/screenshots/0.3/3.psd b/screenshots/0.3/3.psd
new file mode 100644
index 0000000..247222b
Binary files /dev/null and b/screenshots/0.3/3.psd differ
diff --git a/screenshots/0.3/tiproid.gif b/screenshots/0.3/tiproid.gif
new file mode 100644
index 0000000..501266b
Binary files /dev/null and b/screenshots/0.3/tiproid.gif differ
diff --git a/src/net/thauvin/erik/android/tiproid/Tiproid.java b/src/net/thauvin/erik/android/tiproid/Tiproid.java
index 0105c7c..136ef09 100644
--- a/src/net/thauvin/erik/android/tiproid/Tiproid.java
+++ b/src/net/thauvin/erik/android/tiproid/Tiproid.java
@@ -249,66 +249,76 @@ public class Tiproid extends Activity
taxTotal = parseInt(taxTxt);
}
- final int subTotal = parseInt(billTxt) - taxTotal;
- final int tipRate = Integer.parseInt(tipTxt);
- final int splitCount = Integer.parseInt(splitTxt);
- int tipTotal = (subTotal * tipRate) / 100;
- int billTotal = subTotal + tipTotal + taxTotal;
+ final int billTotal = parseInt(billTxt);
- if ((billTotal % 100) < 50)
+ if (taxTotal == billTotal)
{
- while ((billTotal % 100) != 0)
- {
- tipTotal--;
- billTotal = subTotal + tipTotal + taxTotal;
- }
+ Toast.makeText(Tiproid.this, R.string.error_identical_txt, Toast.LENGTH_SHORT).show();
}
else
{
- while ((billTotal % 100) != 0)
+
+ final int subTotal = billTotal - taxTotal;
+ final int tipRate = Integer.parseInt(tipTxt);
+ final int splitCount = Integer.parseInt(splitTxt);
+ int tipSum = (subTotal * tipRate) / 100;
+ int billSum = subTotal + tipSum + taxTotal;
+
+ if ((billSum % 100) < 50)
{
- tipTotal++;
- billTotal = subTotal + tipTotal + taxTotal;
- }
- }
-
- final LayoutInflater factory = LayoutInflater.from(this);
- final View resultView = factory.inflate(R.layout.result, null);
-
- final TextView tipFld = (TextView) resultView.findViewById(R.id.result_tip_fld);
- final TextView totalFld = (TextView) resultView.findViewById(R.id.result_total_fld);
- final TextView tipLbl = (TextView) resultView.findViewById(R.id.result_tip_lbl);
- final TextView splitFld = (TextView) resultView.findViewById(R.id.result_split_fld);
- final TextView splitLbl = (TextView) resultView.findViewById(R.id.result_split_lbl);
-
- tipLbl.setText(tipLbl.getText().toString().replace("?", tipTxt));
- tipFld.setText(parseStr(tipTotal));
- totalFld.setText(parseStr(billTotal));
-
- if (splitCount == 1)
- {
- splitFld.setText("");
- splitLbl.setText("");
- }
- else
- {
- splitLbl.setText(splitLbl.getText().toString().replace("?", splitTxt));
- int split = billTotal / splitCount;
- if ((split * splitCount) < billTotal)
- {
- split += 1;
- }
- splitFld.setText(parseStr(split));
- }
-
- new AlertDialog.Builder(this).setView(resultView).setPositiveButton(R.string.alert_dialog_ok,
- new DialogInterface.OnClickListener()
+ while ((billSum % 100) != 0)
{
- public void onClick(DialogInterface dialog, int whichButton)
+ tipSum--;
+ billSum = subTotal + tipSum + taxTotal;
+ }
+ }
+ else
+ {
+ while ((billSum % 100) != 0)
+ {
+ tipSum++;
+ billSum = subTotal + tipSum + taxTotal;
+ }
+ }
+
+ final LayoutInflater factory = LayoutInflater.from(this);
+ final View resultView = factory.inflate(R.layout.result, null);
+
+ final TextView tipFld = (TextView) resultView.findViewById(R.id.result_tip_fld);
+ final TextView totalFld = (TextView) resultView.findViewById(R.id.result_total_fld);
+ final TextView tipLbl = (TextView) resultView.findViewById(R.id.result_tip_lbl);
+ final TextView splitFld = (TextView) resultView.findViewById(R.id.result_split_fld);
+ final TextView splitLbl = (TextView) resultView.findViewById(R.id.result_split_lbl);
+
+ tipLbl.setText(tipLbl.getText().toString().replace("?", tipTxt));
+ tipFld.setText(parseStr(tipSum));
+ totalFld.setText(parseStr(billSum));
+
+ if (splitCount == 1)
+ {
+ splitFld.setText("");
+ splitLbl.setText("");
+ }
+ else
+ {
+ splitLbl.setText(splitLbl.getText().toString().replace("?", splitTxt));
+ int split = billSum / splitCount;
+ if ((split * splitCount) < billSum)
+ {
+ split += 1;
+ }
+ splitFld.setText(parseStr(split));
+ }
+
+ new AlertDialog.Builder(this).setView(resultView).setPositiveButton(R.string.alert_dialog_ok,
+ new DialogInterface.OnClickListener()
{
- // do nothing
- }
- }).show();
+ public void onClick(DialogInterface dialog, int whichButton)
+ {
+ // do nothing
+ }
+ }).show();
+ }
}
}
@@ -358,7 +368,6 @@ public class Tiproid extends Activity
else
{
taxFld.setHint(getString(R.string.main_tax_hint_txt));
-
}
final ArrayAdapter tipAdapter = ArrayAdapter.createFromResource(this, R.array.main_tip_array,