Created tag 0.4.0.
This commit is contained in:
parent
258d1ee693
commit
ba3103109f
13 changed files with 133 additions and 115 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="net.thauvin.erik.android.tiproid" android:versionCode="2" android:versionName="0.2">
|
package="net.thauvin.erik.android.tiproid" android:installLocation="auto"
|
||||||
|
android:versionName="0.4" android:versionCode="4">
|
||||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||||
<activity android:label="@string/app_name" android:name="Tiproid">
|
<activity android:label="@string/app_name" android:name="Tiproid">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -9,4 +10,5 @@
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
<uses-sdk android:minSdkVersion="2"></uses-sdk>
|
||||||
</manifest>
|
</manifest>
|
14
default.properties
Normal file
14
default.properties
Normal file
|
@ -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=
|
|
@ -70,6 +70,7 @@ public final class R {
|
||||||
public static final int alert_dialog_ok=0x7f050003;
|
public static final int alert_dialog_ok=0x7f050003;
|
||||||
public static final int app_name=0x7f050000;
|
public static final int app_name=0x7f050000;
|
||||||
public static final int error_bill_txt=0x7f050010;
|
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_bill_lbl_txt=0x7f050005;
|
||||||
public static final int main_calc_btn_txt=0x7f050006;
|
public static final int main_calc_btn_txt=0x7f050006;
|
||||||
public static final int main_reset_btn_txt=0x7f050007;
|
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_split_lbl_txt=0x7f05000e;
|
||||||
public static final int result_tip_lbl_txt=0x7f05000d;
|
public static final int result_tip_lbl_txt=0x7f05000d;
|
||||||
public static final int result_total_lbl_txt=0x7f05000f;
|
public static final int result_total_lbl_txt=0x7f05000f;
|
||||||
public static final int sample_txt=0x7f050011;
|
public static final int sample_txt=0x7f050012;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,55 +1,48 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
android:orientation="vertical" android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:layout_width="wrap_content" android:paddingLeft="10dip"
|
||||||
<EditText android:layout_height="wrap_content"
|
android:paddingRight="10dip">
|
||||||
android:layout_width="fill_parent" android:layout_marginLeft="20dip"
|
<EditText android:scrollHorizontally="true"
|
||||||
android:scrollHorizontally="true" android:autoText="false"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:capitalize="none" android:textAppearance="?android:attr/textAppearanceMedium"
|
android:id="@+id/calc_edit_fld" android:autoText="false"
|
||||||
android:layout_marginRight="20dip" android:numeric="decimal"
|
android:capitalize="none"
|
||||||
android:gravity="right" android:id="@+id/calc_edit_fld" />
|
android:layout_height="fill_parent" android:numeric="decimal"
|
||||||
|
android:layout_width="fill_parent" android:gravity="right"/>
|
||||||
<TableLayout android:id="@+id/TableLayout01"
|
<TableLayout android:id="@+id/TableLayout01"
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content">
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<TableRow android:id="@+id/TableRow01" android:layout_width="wrap_content"
|
android:layout_height="wrap_content" android:layout_width="wrap_content">
|
||||||
android:layout_height="wrap_content" android:layout_marginLeft="20dip"
|
<TableRow android:id="@+id/TableRow01">
|
||||||
android:layout_marginRight="20dip">
|
<Button android:id="@+id/Button01" android:text="1"
|
||||||
<Button android:id="@+id/Button01" android:layout_width="wrap_content"
|
android:width="80dip"></Button>
|
||||||
android:layout_height="wrap_content" android:text="1"></Button>
|
<Button android:id="@+id/Button02" android:text="2"
|
||||||
<Button android:id="@+id/Button02" android:layout_width="wrap_content"
|
android:width="80dip"></Button>
|
||||||
android:layout_height="wrap_content" android:text="2"></Button>
|
<Button android:id="@+id/Button03" android:text="3"
|
||||||
<Button android:id="@+id/Button03" android:layout_width="wrap_content"
|
android:width="80dip"></Button>
|
||||||
android:layout_height="wrap_content" android:text="3"></Button>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:id="@+id/TableRow02" android:layout_width="wrap_content"
|
<TableRow android:id="@+id/TableRow02">
|
||||||
android:layout_height="wrap_content" android:layout_marginRight="20dip"
|
<Button android:id="@+id/Button04" android:text="4"
|
||||||
android:layout_marginLeft="20dip">
|
android:width="80dip"></Button>
|
||||||
<Button android:id="@+id/Button04" android:layout_width="wrap_content"
|
<Button android:id="@+id/Button05" android:text="5"
|
||||||
android:layout_height="wrap_content" android:text="4"></Button>
|
android:width="80dip"></Button>
|
||||||
<Button android:id="@+id/Button05" android:layout_width="wrap_content"
|
<Button android:id="@+id/Button06" android:text="6"
|
||||||
android:layout_height="wrap_content" android:text="5"></Button>
|
android:width="80dip"></Button>
|
||||||
<Button android:id="@+id/Button06" android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" android:text="6"></Button>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:id="@+id/TableRow03" android:layout_width="wrap_content"
|
<TableRow android:id="@+id/TableRow03">
|
||||||
android:layout_height="wrap_content" android:layout_marginLeft="20dip">
|
<Button android:id="@+id/Button07" android:text="7"
|
||||||
<Button android:id="@+id/Button07" android:layout_width="wrap_content"
|
android:width="80dip"></Button>
|
||||||
android:layout_height="wrap_content" android:text="7"></Button>
|
<Button android:id="@+id/Button08" android:text="8"
|
||||||
<Button android:id="@+id/Button08" android:layout_width="wrap_content"
|
android:width="80dip"></Button>
|
||||||
android:layout_height="wrap_content" android:text="8"></Button>
|
<Button android:id="@+id/Button09" android:text="9"
|
||||||
<Button android:id="@+id/Button09" android:layout_width="wrap_content"
|
android:width="80dip"></Button>
|
||||||
android:layout_height="wrap_content" android:text="9"></Button>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:id="@+id/TableRow04" android:layout_width="wrap_content"
|
<TableRow android:id="@+id/TableRow04">
|
||||||
android:layout_height="wrap_content" android:layout_marginLeft="20dip">
|
<Button android:id="@+id/ButtonDot" android:text="."
|
||||||
<Button android:layout_width="wrap_content"
|
android:width="80dip"></Button>
|
||||||
android:layout_height="wrap_content" android:id="@+id/ButtonDot"
|
<Button android:id="@+id/Button0" android:text="0"
|
||||||
android:text="."></Button>
|
android:width="80dip"></Button>
|
||||||
<Button android:layout_width="wrap_content"
|
<ImageButton android:id="@+id/ButtonBS" android:src="@drawable/delete"
|
||||||
android:layout_height="wrap_content" android:id="@+id/Button0"
|
android:width="80dip"></ImageButton>
|
||||||
android:text="0"></Button>
|
|
||||||
<ImageButton android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" android:id="@+id/ButtonBS"
|
|
||||||
android:src="@drawable/delete"></ImageButton>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -6,14 +6,13 @@
|
||||||
android:layout_width="wrap_content" android:layout_marginRight="20dip"
|
android:layout_width="wrap_content" android:layout_marginRight="20dip"
|
||||||
android:text="@string/main_tax_lbl_txt" android:gravity="left"
|
android:text="@string/main_tax_lbl_txt" android:gravity="left"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
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"/>
|
||||||
<LinearLayout android:layout_width="fill_parent"
|
<LinearLayout android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content" android:baselineAligned="false"
|
android:layout_height="wrap_content" android:baselineAligned="false"
|
||||||
android:layout_marginRight="20dip" android:layout_marginLeft="20dip">
|
android:layout_marginRight="20dip" android:layout_marginLeft="20dip">
|
||||||
<EditText android:layout_height="wrap_content"
|
<EditText android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical" android:numeric="decimal"
|
android:layout_gravity="center_vertical" android:gravity="right" android:id="@+id/main_tax_fld"
|
||||||
android:gravity="right" android:id="@+id/main_tax_fld"
|
android:layout_width="wrap_content" android:minWidth="200dip" android:numeric="decimal"/>
|
||||||
android:layout_width="wrap_content" android:minWidth="200dip" />
|
|
||||||
<ImageButton android:layout_width="wrap_content"
|
<ImageButton android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" android:src="@drawable/calc"
|
android:layout_height="wrap_content" android:src="@drawable/calc"
|
||||||
android:id="@+id/main_tax_edit_btn" android:minWidth="81dip"></ImageButton>
|
android:id="@+id/main_tax_edit_btn" android:minWidth="81dip"></ImageButton>
|
||||||
|
@ -22,14 +21,13 @@
|
||||||
android:layout_width="wrap_content" android:layout_marginRight="20dip"
|
android:layout_width="wrap_content" android:layout_marginRight="20dip"
|
||||||
android:text="@string/main_bill_lbl_txt" android:gravity="left"
|
android:text="@string/main_bill_lbl_txt" android:gravity="left"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
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"/>
|
||||||
<LinearLayout android:layout_width="fill_parent"
|
<LinearLayout android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content" android:baselineAligned="false"
|
android:layout_height="wrap_content" android:baselineAligned="false"
|
||||||
android:layout_marginRight="20dip" android:layout_marginLeft="20dip">
|
android:layout_marginRight="20dip" android:layout_marginLeft="20dip">
|
||||||
<EditText android:layout_height="wrap_content"
|
<EditText android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical" android:numeric="decimal"
|
android:layout_gravity="center_vertical" android:gravity="right" android:id="@+id/main_bill_fld"
|
||||||
android:gravity="right" android:id="@+id/main_bill_fld"
|
android:layout_width="wrap_content" android:minWidth="200dip" android:numeric="decimal"/>
|
||||||
android:layout_width="wrap_content" android:minWidth="200dip" />
|
|
||||||
<ImageButton android:layout_width="wrap_content"
|
<ImageButton android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" android:src="@drawable/calc"
|
android:layout_height="wrap_content" android:src="@drawable/calc"
|
||||||
android:id="@+id/main_bill_edit_btn" android:minWidth="81dip"></ImageButton>
|
android:id="@+id/main_bill_edit_btn" android:minWidth="81dip"></ImageButton>
|
||||||
|
@ -43,11 +41,11 @@
|
||||||
android:layout_width="wrap_content" android:gravity="left"
|
android:layout_width="wrap_content" android:gravity="left"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:id="@+id/main_tip_lbl" android:text="@string/main_tip_lbl_txt"
|
android:id="@+id/main_tip_lbl" android:text="@string/main_tip_lbl_txt"
|
||||||
android:minWidth="200dip" />
|
android:minWidth="200dip" android:textSize="15px"/>
|
||||||
<TextView android:layout_height="wrap_content"
|
<TextView android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content" android:gravity="left"
|
android:layout_width="wrap_content" android:gravity="left"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:id="@+id/main_tip_lbl" android:text="@string/main_split_lbl_txt" />
|
android:id="@+id/main_tip_lbl" android:text="@string/main_split_lbl_txt" android:textSize="15px"/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:id="@+id/TableRow02" android:layout_width="wrap_content"
|
<TableRow android:id="@+id/TableRow02" android:layout_width="wrap_content"
|
||||||
android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
|
android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
|
||||||
|
@ -68,10 +66,10 @@
|
||||||
android:layout_height="wrap_content" android:layout_marginTop="20dip">
|
android:layout_height="wrap_content" android:layout_marginTop="20dip">
|
||||||
<Button android:layout_width="wrap_content"
|
<Button android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" android:text="@string/main_calc_btn_txt"
|
android:layout_height="wrap_content" android:text="@string/main_calc_btn_txt"
|
||||||
android:id="@+id/main_calculate_btn" style="?android:attr/buttonStyleSmall"></Button>
|
android:id="@+id/main_calculate_btn"></Button>
|
||||||
<Button android:layout_width="wrap_content"
|
<Button android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" android:text="@string/main_reset_btn_txt"
|
android:layout_height="wrap_content" android:text="@string/main_reset_btn_txt"
|
||||||
android:id="@+id/main_reset_btn" style="?android:attr/buttonStyleSmall"></Button>
|
android:id="@+id/main_reset_btn"></Button>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Tiproid</string>
|
<string name="app_name">Tiproid</string>
|
||||||
<string name="about_txt">© 2008 Erik C. Thauvin\nAll Rights Reserved\n\nerik@thauvin.net\n\nhttp://mobile.thauvin.net</string>
|
<string name="about_txt">© 2008-10 Erik C. Thauvin\nAll Rights Reserved\n\nerik@thauvin.net\n\nhttp://mobile.thauvin.net/</string>
|
||||||
<string name="about_menu_txt">About</string>
|
<string name="about_menu_txt">About</string>
|
||||||
<string name="alert_dialog_ok">OK</string>
|
<string name="alert_dialog_ok">OK</string>
|
||||||
<string name="alert_dialog_cancel">Cancel</string>
|
<string name="alert_dialog_cancel">Cancel</string>
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
<string name="result_tip_lbl_txt">Tip ?%:</string>
|
<string name="result_tip_lbl_txt">Tip ?%:</string>
|
||||||
<string name="result_split_lbl_txt">Split x ?:</string>
|
<string name="result_split_lbl_txt">Split x ?:</string>
|
||||||
<string name="result_total_lbl_txt">Total:</string>
|
<string name="result_total_lbl_txt">Total:</string>
|
||||||
<string name="error_bill_txt">Please enter the bill amount...</string>
|
<string name="error_bill_txt">Please enter the bill amount!</string>
|
||||||
|
<string name="error_identical_txt">Amounts should not be identical!</string>
|
||||||
<string name="sample_txt">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.</string>
|
<string name="sample_txt">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.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
BIN
screenshots/0.3/1.png
Normal file
BIN
screenshots/0.3/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
BIN
screenshots/0.3/1.psd
Normal file
BIN
screenshots/0.3/1.psd
Normal file
Binary file not shown.
BIN
screenshots/0.3/2.png
Normal file
BIN
screenshots/0.3/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
screenshots/0.3/2.psd
Normal file
BIN
screenshots/0.3/2.psd
Normal file
Binary file not shown.
BIN
screenshots/0.3/3.psd
Normal file
BIN
screenshots/0.3/3.psd
Normal file
Binary file not shown.
BIN
screenshots/0.3/tiproid.gif
Normal file
BIN
screenshots/0.3/tiproid.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 353 KiB |
|
@ -249,66 +249,76 @@ public class Tiproid extends Activity
|
||||||
taxTotal = parseInt(taxTxt);
|
taxTotal = parseInt(taxTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int subTotal = parseInt(billTxt) - taxTotal;
|
final int billTotal = parseInt(billTxt);
|
||||||
final int tipRate = Integer.parseInt(tipTxt);
|
|
||||||
final int splitCount = Integer.parseInt(splitTxt);
|
|
||||||
int tipTotal = (subTotal * tipRate) / 100;
|
|
||||||
int billTotal = subTotal + tipTotal + taxTotal;
|
|
||||||
|
|
||||||
if ((billTotal % 100) < 50)
|
if (taxTotal == billTotal)
|
||||||
{
|
{
|
||||||
while ((billTotal % 100) != 0)
|
Toast.makeText(Tiproid.this, R.string.error_identical_txt, Toast.LENGTH_SHORT).show();
|
||||||
{
|
|
||||||
tipTotal--;
|
|
||||||
billTotal = subTotal + tipTotal + taxTotal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
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++;
|
while ((billSum % 100) != 0)
|
||||||
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()
|
|
||||||
{
|
{
|
||||||
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
|
public void onClick(DialogInterface dialog, int whichButton)
|
||||||
}
|
{
|
||||||
}).show();
|
// do nothing
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +368,6 @@ public class Tiproid extends Activity
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
taxFld.setHint(getString(R.string.main_tax_hint_txt));
|
taxFld.setHint(getString(R.string.main_tax_hint_txt));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayAdapter<CharSequence> tipAdapter = ArrayAdapter.createFromResource(this, R.array.main_tip_array,
|
final ArrayAdapter<CharSequence> tipAdapter = ArrayAdapter.createFromResource(this, R.array.main_tip_array,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue