diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 66eaa51..0000000 --- a/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.DS_Store -.gradle -/.idea/libraries -/.idea/workspace.xml -/build -/captures -/local.properties -/versions.properties -Thumbs.db \ No newline at end of file diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 6038314..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -Tiproid \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 9a8b7e5..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 8d2df47..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 7965fcf..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 7f8f7b6..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..e775d1a --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Tiproid.iml b/Tiproid.iml deleted file mode 100644 index b6ad37a..0000000 --- a/Tiproid.iml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/app/app.iml b/app/app.iml deleted file mode 100644 index fd8e9c8..0000000 --- a/app/app.iml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 6bae8c6..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'versionPlugin' - -android { - compileSdkVersion 8 - buildToolsVersion "21.1.2" - - defaultConfig { - applicationId "net.thauvin.erik.android.tiproid" - minSdkVersion 2 - targetSdkVersion 2 - versionCode 4 - versionName "0.4.0" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } - - versionPlugin { - buildTypesMatcher = 'release' - supportBuildNumber = false - - fileNameFormat = '$projectName' - } -} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml deleted file mode 100644 index a0b193e..0000000 --- a/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml deleted file mode 100644 index 09817c8..0000000 --- a/app/src/main/res/layout/about.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/calc.xml b/app/src/main/res/layout/calc.xml deleted file mode 100644 index dbebd32..0000000 --- a/app/src/main/res/layout/calc.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/res/layout/main.xml b/res/layout/main.xml new file mode 100644 index 0000000..907c845 --- /dev/null +++ b/res/layout/main.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/result.xml b/res/layout/result.xml new file mode 100644 index 0000000..60a25b6 --- /dev/null +++ b/res/layout/result.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/values/arrays.xml b/res/values/arrays.xml new file mode 100644 index 0000000..940859a --- /dev/null +++ b/res/values/arrays.xml @@ -0,0 +1,27 @@ + + + + 5 + 10 + 12 + 15 + 18 + 20 + 25 + 30 + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 0000000..d503695 --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,21 @@ + + + Tiproid + © 2008 Erik C. Thauvin\nAll Rights Reserved\n\nerik@thauvin.net\n\nhttp://mobile.thauvin.net + About + OK + Cancel + Bill Total Amount: + Calculate + Reset + Tax Amount: + Use the keyboard... + Tap button to edit... + Tip %: + Split: + Tip ?%: + Split x ?: + Total: + Please enter the bill amount... + 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.2/1.psd b/screenshots/0.2/1.psd deleted file mode 100644 index 2af9527..0000000 Binary files a/screenshots/0.2/1.psd and /dev/null differ diff --git a/screenshots/0.2/2.psd b/screenshots/0.2/2.psd deleted file mode 100644 index fa7c09b..0000000 Binary files a/screenshots/0.2/2.psd and /dev/null differ diff --git a/screenshots/0.2/3.psd b/screenshots/0.2/3.psd deleted file mode 100644 index 4984544..0000000 Binary files a/screenshots/0.2/3.psd and /dev/null differ diff --git a/screenshots/0.2/tiproid.gif b/screenshots/0.2/tiproid.gif deleted file mode 100644 index 1918509..0000000 Binary files a/screenshots/0.2/tiproid.gif and /dev/null differ diff --git a/screenshots/0.3/1.png b/screenshots/0.3/1.png deleted file mode 100644 index 5496d08..0000000 Binary files a/screenshots/0.3/1.png and /dev/null differ diff --git a/screenshots/0.3/1.psd b/screenshots/0.3/1.psd deleted file mode 100644 index 7cc83c8..0000000 Binary files a/screenshots/0.3/1.psd and /dev/null differ diff --git a/screenshots/0.3/2.png b/screenshots/0.3/2.png deleted file mode 100644 index 8a9b572..0000000 Binary files a/screenshots/0.3/2.png and /dev/null differ diff --git a/screenshots/0.3/2.psd b/screenshots/0.3/2.psd deleted file mode 100644 index 8d51cee..0000000 Binary files a/screenshots/0.3/2.psd and /dev/null differ diff --git a/screenshots/0.3/3.jpg b/screenshots/0.3/3.jpg deleted file mode 100644 index d4f3b4e..0000000 Binary files a/screenshots/0.3/3.jpg and /dev/null differ diff --git a/screenshots/0.3/3.psd b/screenshots/0.3/3.psd deleted file mode 100644 index 247222b..0000000 Binary files a/screenshots/0.3/3.psd and /dev/null differ diff --git a/screenshots/0.3/feature.png b/screenshots/0.3/feature.png deleted file mode 100644 index aabc483..0000000 Binary files a/screenshots/0.3/feature.png and /dev/null differ diff --git a/screenshots/0.3/icon-hi.png b/screenshots/0.3/icon-hi.png deleted file mode 100644 index e843ca3..0000000 Binary files a/screenshots/0.3/icon-hi.png and /dev/null differ diff --git a/screenshots/0.3/promo.png b/screenshots/0.3/promo.png deleted file mode 100644 index f9ae721..0000000 Binary files a/screenshots/0.3/promo.png and /dev/null differ diff --git a/screenshots/0.3/tiproid.gif b/screenshots/0.3/tiproid.gif deleted file mode 100644 index 501266b..0000000 Binary files a/screenshots/0.3/tiproid.gif and /dev/null differ diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e7b4def..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/sign.bat b/sign.bat new file mode 100644 index 0000000..6809692 --- /dev/null +++ b/sign.bat @@ -0,0 +1,10 @@ +@echo off +"%JAVA_HOME%\bin\jarsigner" -verbose -keystore "%USERPROFILE%\personal\android.keystore" "%1" android +if errorlevel 1 goto ERROR +"%JAVA_HOME%\bin\jarsigner" -verify "%1" +if errorlevel 1 goto ERROR +goto DONE +:ERROR +@pause +:DONE +@echo on \ No newline at end of file diff --git a/src/net/thauvin/erik/android/tiproid/R.java b/src/net/thauvin/erik/android/tiproid/R.java new file mode 100644 index 0000000..cbfe4f6 --- /dev/null +++ b/src/net/thauvin/erik/android/tiproid/R.java @@ -0,0 +1,86 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package net.thauvin.erik.android.tiproid; + +public final class R { + public static final class array { + public static final int main_split_array=0x7f040001; + public static final int main_tip_array=0x7f040000; + } + public static final class attr { + } + public static final class drawable { + public static final int calc=0x7f020000; + public static final int delete=0x7f020001; + public static final int icon=0x7f020002; + } + public static final class id { + public static final int Button0=0x7f060011; + public static final int Button01=0x7f060004; + public static final int Button02=0x7f060005; + public static final int Button03=0x7f060006; + public static final int Button04=0x7f060008; + public static final int Button05=0x7f060009; + public static final int Button06=0x7f06000a; + public static final int Button07=0x7f06000c; + public static final int Button08=0x7f06000d; + public static final int Button09=0x7f06000e; + public static final int ButtonBS=0x7f060012; + public static final int ButtonDot=0x7f060010; + public static final int TableLayout01=0x7f060002; + public static final int TableRow01=0x7f060003; + public static final int TableRow02=0x7f060007; + public static final int TableRow03=0x7f06000b; + public static final int TableRow04=0x7f06000f; + public static final int about_text_fld=0x7f060000; + public static final int calc_edit_fld=0x7f060001; + public static final int main_bill_edit_btn=0x7f060018; + public static final int main_bill_fld=0x7f060017; + public static final int main_bill_lbl=0x7f060016; + public static final int main_calculate_btn=0x7f06001c; + public static final int main_reset_btn=0x7f06001d; + public static final int main_split_spin=0x7f06001b; + public static final int main_tax_edit_btn=0x7f060015; + public static final int main_tax_fld=0x7f060014; + public static final int main_tax_lbl=0x7f060013; + public static final int main_tip_lbl=0x7f060019; + public static final int main_tip_spin=0x7f06001a; + public static final int result_split_fld=0x7f060023; + public static final int result_split_lbl=0x7f060022; + public static final int result_tip_fld=0x7f06001f; + public static final int result_tip_lbl=0x7f06001e; + public static final int result_total_fld=0x7f060021; + public static final int result_total_lbl=0x7f060020; + } + public static final class layout { + public static final int about=0x7f030000; + public static final int calc=0x7f030001; + public static final int main=0x7f030002; + public static final int result=0x7f030003; + } + public static final class string { + public static final int about_menu_txt=0x7f050002; + public static final int about_txt=0x7f050001; + public static final int alert_dialog_cancel=0x7f050004; + 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 main_bill_lbl_txt=0x7f050005; + public static final int main_calc_btn_txt=0x7f050006; + public static final int main_reset_btn_txt=0x7f050007; + public static final int main_split_lbl_txt=0x7f05000c; + public static final int main_tax_hint_land_txt=0x7f050009; + public static final int main_tax_hint_txt=0x7f05000a; + public static final int main_tax_lbl_txt=0x7f050008; + public static final int main_tip_lbl_txt=0x7f05000b; + 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; + } +} diff --git a/app/src/main/java/net/thauvin/erik/android/tiproid/Tiproid.java b/src/net/thauvin/erik/android/tiproid/Tiproid.java similarity index 85% rename from app/src/main/java/net/thauvin/erik/android/tiproid/Tiproid.java rename to src/net/thauvin/erik/android/tiproid/Tiproid.java index 3f349fe..0105c7c 100644 --- a/app/src/main/java/net/thauvin/erik/android/tiproid/Tiproid.java +++ b/src/net/thauvin/erik/android/tiproid/Tiproid.java @@ -66,7 +66,7 @@ import android.widget.Toast; public class Tiproid extends Activity { - private static final String PREFS_TIP_RATE = "TipRate"; + public static final String PREFS_TIP_RATE = "TipRate"; /** * Displays the calc dialog. @@ -229,7 +229,7 @@ public class Tiproid extends Activity * @param billTxt The bill amount. * @param taxTxt The tax amount. * @param tipTxt The tip rate. - * @param splitTxt The split count. + * @param splitTx The split count. */ private void calculate(String billTxt, String taxTxt, String tipTxt, String splitTxt) { @@ -249,76 +249,66 @@ public class Tiproid extends Activity taxTotal = parseInt(taxTxt); } - final int billTotal = parseInt(billTxt); + 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; - if (taxTotal == billTotal) + if ((billTotal % 100) < 50) { - Toast.makeText(Tiproid.this, R.string.error_identical_txt, Toast.LENGTH_SHORT).show(); + while ((billTotal % 100) != 0) + { + tipTotal--; + billTotal = subTotal + tipTotal + taxTotal; + } } else { - - 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) + while ((billTotal % 100) != 0) { - while ((billSum % 100) != 0) - { - tipSum--; - billSum = subTotal + tipSum + taxTotal; - } + tipTotal++; + billTotal = subTotal + tipTotal + 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() - { - public void onClick(DialogInterface dialog, int whichButton) - { - // do nothing - } - }).show(); } + + 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) + { + // do nothing + } + }).show(); } } @@ -337,7 +327,7 @@ public class Tiproid extends Activity { return ""; } - } + }; /** * Initializes the various controls. @@ -368,6 +358,7 @@ 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,