Moved to Android Studio.

This commit is contained in:
Erik C. Thauvin 2015-04-15 16:33:38 -07:00
parent 7d5c926a27
commit f3c2fcba14
47 changed files with 935 additions and 360 deletions

1
app/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

90
app/app.iml Normal file
View file

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="Tiproid" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 8 Platform (2)" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

29
app/build.gradle Normal file
View file

@ -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'
}
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.thauvin.erik.android.tiproid"
android:installLocation="auto">
<application
android:icon="@drawable/icon"
android:label="@string/app_name">
<activity
android:label="@string/app_name"
android:name="Tiproid">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View file

@ -0,0 +1,519 @@
/*
* @(#)Tiproid.java
*
* Copyright (c) 2008, Erik C. Thauvin (http://erik.thauvin.net/)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of the authors nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*
*/
package net.thauvin.erik.android.tiproid;
/**
* <code>Tiproid</code> is a simple tip calculator for Android.
*
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
* @version $Revision$, $Date$
* @created Oct 9, 2008
* @since 1.0
*/
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
public class Tiproid extends Activity
{
private static final String PREFS_TIP_RATE = "TipRate";
/**
* Displays the calc dialog.
*
* @param editFld The edit field.
*/
private void calcDialog(final EditText editFld)
{
final LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.calc, null);
final Button zero = (Button) textEntryView.findViewById(R.id.Button0);
final Button one = (Button) textEntryView.findViewById(R.id.Button01);
final Button two = (Button) textEntryView.findViewById(R.id.Button02);
final Button three = (Button) textEntryView.findViewById(R.id.Button03);
final Button four = (Button) textEntryView.findViewById(R.id.Button04);
final Button five = (Button) textEntryView.findViewById(R.id.Button05);
final Button six = (Button) textEntryView.findViewById(R.id.Button06);
final Button seven = (Button) textEntryView.findViewById(R.id.Button07);
final Button eight = (Button) textEntryView.findViewById(R.id.Button08);
final Button nine = (Button) textEntryView.findViewById(R.id.Button09);
final Button dot = (Button) textEntryView.findViewById(R.id.ButtonDot);
final ImageButton bs = (ImageButton) textEntryView.findViewById(R.id.ButtonBS);
final String curText = editFld.getText().toString();
final EditText calcEdit = (EditText) textEntryView.findViewById(R.id.calc_edit_fld);
if (!TextUtils.isEmpty(curText))
{
calcEdit.setText(curText);
}
zero.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("0");
}
});
one.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("1");
}
});
two.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("2");
}
});
three.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("3");
}
});
four.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("4");
}
});
five.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("5");
}
});
six.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("6");
}
});
seven.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("7");
}
});
eight.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("8");
}
});
nine.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append("9");
}
});
dot.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcEdit.append(".");
}
});
bs.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
final String txt = calcEdit.getText().toString();
if (!TextUtils.isEmpty(txt))
{
if (txt.length() > 0)
{
calcEdit.setText(txt.subSequence(0, txt.length() - 1));
calcEdit.setSelection(txt.length() - 1);
}
}
}
});
new AlertDialog.Builder(this).setView(textEntryView).setPositiveButton(R.string.alert_dialog_ok,
new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int whichButton)
{
editFld.setText(calcEdit.getText().toString());
editFld.requestFocus();
}
}).setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int whichButton)
{
editFld.requestFocus();
}
}).show();
}
/**
* Calculates the tip and displays the result dialog.
*
* @param billTxt The bill amount.
* @param taxTxt The tax amount.
* @param tipTxt The tip rate.
* @param splitTxt The split count.
*/
private void calculate(String billTxt, String taxTxt, String tipTxt, String splitTxt)
{
if (TextUtils.isEmpty(billTxt))
{
Toast.makeText(Tiproid.this, R.string.error_bill_txt, Toast.LENGTH_SHORT).show();
}
else
{
final int taxTotal;
if (TextUtils.isEmpty(taxTxt))
{
taxTotal = 0;
}
else
{
taxTotal = parseInt(taxTxt);
}
final int billTotal = parseInt(billTxt);
if (taxTotal == billTotal)
{
Toast.makeText(Tiproid.this, R.string.error_identical_txt, Toast.LENGTH_SHORT).show();
}
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 ((billSum % 100) != 0)
{
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()
{
public void onClick(DialogInterface dialog, int whichButton)
{
// do nothing
}
}).show();
}
}
}
/**
* Returns the current version number.
*
* @return The current version number or empty.
*/
private String getVersionNumber()
{
try
{
return getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
}
catch (final NameNotFoundException e)
{
return "";
}
}
/**
* Initializes the various controls.
*/
private void init()
{
final EditText billFld = (EditText) findViewById(R.id.main_bill_fld);
final EditText taxFld = (EditText) findViewById(R.id.main_tax_fld);
final Spinner tipSpin = (Spinner) findViewById(R.id.main_tip_spin);
final Spinner splitSpin = (Spinner) findViewById(R.id.main_split_spin);
final Button calcBtn = (Button) findViewById(R.id.main_calculate_btn);
final Button resetBtn = (Button) findViewById(R.id.main_reset_btn);
final ImageButton billEditBtn = (ImageButton) findViewById(R.id.main_bill_edit_btn);
final ImageButton taxEditBtn = (ImageButton) findViewById(R.id.main_tax_edit_btn);
// Disable edit buttons in landscape mode
final boolean enableBtns = getWindow().getWindowManager().getDefaultDisplay().getWidth() < getWindow().getWindowManager()
.getDefaultDisplay().getHeight();
billEditBtn.setEnabled(enableBtns);
taxEditBtn.setEnabled(enableBtns);
if (!enableBtns)
{
taxFld.setHint(getString(R.string.main_tax_hint_land_txt));
}
else
{
taxFld.setHint(getString(R.string.main_tax_hint_txt));
}
final ArrayAdapter<CharSequence> tipAdapter = ArrayAdapter.createFromResource(this, R.array.main_tip_array,
android.R.layout.simple_spinner_item);
final int defaultTipRate = (tipAdapter.getCount() / 2) - 1;
tipAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
tipSpin.setAdapter(tipAdapter);
final ArrayAdapter<CharSequence> splitAdapter = ArrayAdapter.createFromResource(this, R.array.main_split_array,
android.R.layout.simple_spinner_item);
splitAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
splitSpin.setAdapter(splitAdapter);
final SharedPreferences settings = getSharedPreferences(getString(R.string.app_name), Context.MODE_PRIVATE);
tipSpin.setSelection(settings.getInt(PREFS_TIP_RATE, defaultTipRate));
calcBtn.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calculate(billFld.getText().toString(), taxFld.getText().toString(), tipSpin.getSelectedItem().toString(), splitSpin
.getSelectedItem().toString());
}
});
resetBtn.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
billFld.setText("");
taxFld.setText("");
splitSpin.setSelection(0);
tipSpin.setSelection(settings.getInt(PREFS_TIP_RATE, defaultTipRate));
}
});
billEditBtn.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcDialog(billFld);
}
});
taxEditBtn.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View view)
{
calcDialog(taxFld);
}
});
}
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
init();
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
menu.add(0, Menu.FIRST, 0, R.string.about_menu_txt).setIcon(android.R.drawable.ic_menu_info_details);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
if (item.getItemId() == Menu.FIRST)
{
final LayoutInflater factory = LayoutInflater.from(this);
final View aboutView = factory.inflate(R.layout.about, null);
new AlertDialog.Builder(this).setView(aboutView).setIcon(android.R.drawable.ic_dialog_info).setTitle(
getString(R.string.app_name) + ' ' + getVersionNumber()).setPositiveButton(R.string.alert_dialog_ok,
new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int whichButton)
{
// do nothing
}
}).show();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onStop()
{
super.onStop();
final SharedPreferences settings = getSharedPreferences(getString(R.string.app_name), Context.MODE_PRIVATE);
final SharedPreferences.Editor editor = settings.edit();
final Spinner tipSpin = (Spinner) findViewById(R.id.main_tip_spin);
editor.putInt(PREFS_TIP_RATE, tipSpin.getSelectedItemPosition());
editor.commit();
}
/**
* Parses a given string to an integer, the decimal point is removed.
*
* @param str The string to parse.
* @return The parsed integer.
*/
private int parseInt(String str)
{
final int dec = str.lastIndexOf('.');
final int len = str.length();
if (dec == -1)
{
return Integer.parseInt(str + "00");
}
else if (dec == (len - 1))
{
return Integer.parseInt(str.substring(0, dec) + "00");
}
else if (dec == (len - 2))
{
return Integer.parseInt(str.substring(0, dec) + str.substring(dec + 1) + '0');
}
return Integer.parseInt(str.substring(0, dec) + str.substring(dec + 1, dec + 3));
}
/**
* Parses the given integer into to a string, the decimal point is added.
*
* @param i The integer.
* @return The parsed string.
*/
private String parseStr(int i)
{
final String s = String.valueOf(i);
return s.substring(0, s.length() - 2) + '.' + s.substring(s.length() - 2);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
<TextView
android:id="@+id/about_text_fld"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginTop="20dip"
android:gravity="center"
android:autoLink="web|email"
android:layout_marginBottom="20dip"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:text="@string/about_txt"/>
</LinearLayout>

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingLeft="10dip"
android:paddingRight="10dip">
<EditText
android:scrollHorizontally="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/calc_edit_fld"
android:autoText="false"
android:capitalize="none"
android:layout_height="fill_parent"
android:numeric="decimal"
android:layout_width="fill_parent"
android:gravity="right" />
<TableLayout
android:id="@+id/TableLayout01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<TableRow android:id="@+id/TableRow01">
<Button
android:id="@+id/Button01"
android:text="1"
android:width="80dip"/>
<Button
android:id="@+id/Button02"
android:text="2"
android:width="80dip"/>
<Button
android:id="@+id/Button03"
android:text="3"
android:width="80dip"/>
</TableRow>
<TableRow android:id="@+id/TableRow02">
<Button
android:id="@+id/Button04"
android:text="4"
android:width="80dip"/>
<Button
android:id="@+id/Button05"
android:text="5"
android:width="80dip"/>
<Button
android:id="@+id/Button06"
android:text="6"
android:width="80dip"/>
</TableRow>
<TableRow android:id="@+id/TableRow03">
<Button
android:id="@+id/Button07"
android:text="7"
android:width="80dip"/>
<Button
android:id="@+id/Button08"
android:text="8"
android:width="80dip"/>
<Button
android:id="@+id/Button09"
android:text="9"
android:width="80dip"/>
</TableRow>
<TableRow android:id="@+id/TableRow04">
<Button
android:id="@+id/ButtonDot"
android:text="."
android:width="80dip"/>
<Button
android:id="@+id/Button0"
android:text="0"
android:width="80dip"/>
<ImageButton
android:id="@+id/ButtonBS"
android:src="@drawable/delete"
android:width="80dip"/>
</TableRow>
</TableLayout>
</LinearLayout>

View file

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginRight="20dip"
android:text="@string/main_tax_lbl_txt"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/main_tax_lbl"
android:layout_marginLeft="20dip"
android:textSize="15px" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:layout_marginRight="20dip"
android:layout_marginLeft="20dip">
<EditText
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="right"
android:id="@+id/main_tax_fld"
android:layout_width="wrap_content"
android:minWidth="200dip"
android:numeric="decimal" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/calc"
android:id="@+id/main_tax_edit_btn"
android:minWidth="81dip"/>
</LinearLayout>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginRight="20dip"
android:text="@string/main_bill_lbl_txt"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/main_bill_lbl"
android:layout_marginLeft="20dip"
android:textSize="15px" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:layout_marginRight="20dip"
android:layout_marginLeft="20dip">
<EditText
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="right"
android:id="@+id/main_bill_fld"
android:layout_width="wrap_content"
android:minWidth="200dip"
android:numeric="decimal" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/calc"
android:id="@+id/main_bill_edit_btn"
android:minWidth="81dip"/>
</LinearLayout>
<TableLayout
android:id="@+id/TableLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow
android:id="@+id/TableRow01"
android:layout_width="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_height="wrap_content">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/main_tip_lbl"
android:text="@string/main_tip_lbl_txt"
android:minWidth="200dip"
android:textSize="15px" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/main_split_lbl"
android:text="@string/main_split_lbl_txt"
android:textSize="15px" />
</TableRow>
<TableRow
android:id="@+id/TableRow02"
android:layout_width="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:baselineAligned="false">
<Spinner
android:layout_height="wrap_content"
android:id="@+id/main_tip_spin"
android:layout_width="fill_parent"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:baselineAligned="false">
<Spinner
android:layout_height="wrap_content"
android:id="@+id/main_split_spin"
android:layout_width="wrap_content"/>
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/TableRow03"
android:layout_width="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_height="wrap_content"
android:layout_marginTop="20dip">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/main_calc_btn_txt"
android:id="@+id/main_calculate_btn"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/main_reset_btn_txt"
android:id="@+id/main_reset_btn"/>
</TableRow>
</TableLayout>
</LinearLayout>

View file

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableLayout
android:id="@+id/TableLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="20dip">
<TableRow
android:id="@+id/TableRow02"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:minEms="5"
android:text="@string/result_tip_lbl_txt"
android:id="@+id/result_tip_lbl"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0.00"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="right"
android:id="@+id/result_tip_fld"/>
</TableRow>
<TableRow
android:id="@+id/TableRow03"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/result_total_lbl"
android:text="@string/result_total_lbl_txt"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0.00"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="right"
android:id="@+id/result_total_fld"/>
</TableRow>
<TableRow
android:id="@+id/TableRow04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/result_split_lbl"
android:text="@string/result_split_lbl_txt"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0.00"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="right"
android:id="@+id/result_split_fld"/>
</TableRow>
</TableLayout>
</LinearLayout>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="main_tip_array">
<item>5</item>
<item>10</item>
<item>12</item>
<item>15</item>
<item>18</item>
<item>20</item>
<item>25</item>
<item>30</item>
</string-array>
<string-array name="main_split_array">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
</string-array>
</resources>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Tiproid</string>
<string name="about_txt">© 200810 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="alert_dialog_ok">OK</string>
<string name="alert_dialog_cancel">Cancel</string>
<string name="main_bill_lbl_txt">Bill Total Amount:</string>
<string name="main_calc_btn_txt">Calculate</string>
<string name="main_reset_btn_txt">Reset</string>
<string name="main_tax_lbl_txt">Tax Amount:</string>
<string name="main_tax_hint_land_txt">Use the keyboard…</string>
<string name="main_tax_hint_txt">Tap button to edit…</string>
<string name="main_tip_lbl_txt">Tip %:</string>
<string name="main_split_lbl_txt">Split:</string>
<string name="result_tip_lbl_txt">Tip ?%:</string>
<string name="result_split_lbl_txt">Split x ?:</string>
<string name="result_total_lbl_txt">Total:</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>
</resources>