diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66eaa51 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.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 new file mode 100644 index 0000000..6038314 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Tiproid \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..9a8b7e5 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..8d2df47 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..7965fcf --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7f8f7b6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AndroidManifest.xml b/AndroidManifest.xml deleted file mode 100644 index e775d1a..0000000 --- a/AndroidManifest.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Tiproid.iml b/Tiproid.iml new file mode 100644 index 0000000..b6ad37a --- /dev/null +++ b/Tiproid.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/app.iml b/app/app.iml new file mode 100644 index 0000000..fd8e9c8 --- /dev/null +++ b/app/app.iml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..6bae8c6 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,29 @@ +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 new file mode 100644 index 0000000..a0b193e --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/net/thauvin/erik/android/tiproid/Tiproid.java b/app/src/main/java/net/thauvin/erik/android/tiproid/Tiproid.java similarity index 85% rename from src/net/thauvin/erik/android/tiproid/Tiproid.java rename to app/src/main/java/net/thauvin/erik/android/tiproid/Tiproid.java index 0105c7c..3f349fe 100644 --- a/src/net/thauvin/erik/android/tiproid/Tiproid.java +++ b/app/src/main/java/net/thauvin/erik/android/tiproid/Tiproid.java @@ -66,7 +66,7 @@ import android.widget.Toast; public class Tiproid extends Activity { - public static final String PREFS_TIP_RATE = "TipRate"; + private 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 splitTx The split count. + * @param splitTxt The split count. */ private void calculate(String billTxt, String taxTxt, String tipTxt, String splitTxt) { @@ -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(); + } } } @@ -327,7 +337,7 @@ public class Tiproid extends Activity { return ""; } - }; + } /** * Initializes the various controls. @@ -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, diff --git a/res/drawable/calc.png b/app/src/main/res/drawable/calc.png similarity index 100% rename from res/drawable/calc.png rename to app/src/main/res/drawable/calc.png diff --git a/res/drawable/delete.png b/app/src/main/res/drawable/delete.png similarity index 100% rename from res/drawable/delete.png rename to app/src/main/res/drawable/delete.png diff --git a/res/drawable/icon.png b/app/src/main/res/drawable/icon.png similarity index 100% rename from res/drawable/icon.png rename to app/src/main/res/drawable/icon.png diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml new file mode 100644 index 0000000..09817c8 --- /dev/null +++ b/app/src/main/res/layout/about.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/calc.xml b/app/src/main/res/layout/calc.xml new file mode 100644 index 0000000..dbebd32 --- /dev/null +++ b/app/src/main/res/layout/calc.xml @@ -0,0 +1,98 @@ + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - diff --git a/res/layout/main.xml b/res/layout/main.xml deleted file mode 100644 index 907c845..0000000 --- a/res/layout/main.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/layout/result.xml b/res/layout/result.xml deleted file mode 100644 index 60a25b6..0000000 --- a/res/layout/result.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/values/arrays.xml b/res/values/arrays.xml deleted file mode 100644 index 940859a..0000000 --- a/res/values/arrays.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - 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 deleted file mode 100644 index d503695..0000000 --- a/res/values/strings.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - 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 new file mode 100644 index 0000000..2af9527 Binary files /dev/null and b/screenshots/0.2/1.psd differ diff --git a/screenshots/0.2/2.psd b/screenshots/0.2/2.psd new file mode 100644 index 0000000..fa7c09b Binary files /dev/null and b/screenshots/0.2/2.psd differ diff --git a/screenshots/0.2/3.psd b/screenshots/0.2/3.psd new file mode 100644 index 0000000..4984544 Binary files /dev/null and b/screenshots/0.2/3.psd differ diff --git a/screenshots/0.2/tiproid.gif b/screenshots/0.2/tiproid.gif new file mode 100644 index 0000000..1918509 Binary files /dev/null and b/screenshots/0.2/tiproid.gif differ 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.jpg b/screenshots/0.3/3.jpg new file mode 100644 index 0000000..d4f3b4e Binary files /dev/null and b/screenshots/0.3/3.jpg 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/feature.png b/screenshots/0.3/feature.png new file mode 100644 index 0000000..aabc483 Binary files /dev/null and b/screenshots/0.3/feature.png differ diff --git a/screenshots/0.3/icon-hi.png b/screenshots/0.3/icon-hi.png new file mode 100644 index 0000000..e843ca3 Binary files /dev/null and b/screenshots/0.3/icon-hi.png differ diff --git a/screenshots/0.3/promo.png b/screenshots/0.3/promo.png new file mode 100644 index 0000000..f9ae721 Binary files /dev/null and b/screenshots/0.3/promo.png 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/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/sign.bat b/sign.bat deleted file mode 100644 index 6809692..0000000 --- a/sign.bat +++ /dev/null @@ -1,10 +0,0 @@ -@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 deleted file mode 100644 index cbfe4f6..0000000 --- a/src/net/thauvin/erik/android/tiproid/R.java +++ /dev/null @@ -1,86 +0,0 @@ -/* 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; - } -}