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 43c3442..0000000 --- a/AndroidManifest.xml +++ /dev/null @@ -1,13 +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 d718196..0000000 --- a/res/values/strings.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - Tiproid - © 2008-9 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/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/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/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/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