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..43c3442 --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ 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..d718196 --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,21 @@ + + + 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 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/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/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/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/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/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,