Upload Unit Converter 2.0 source files
74
src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="missioncollege.cis063.unitsconverter"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="11"
|
||||
android:targetSdkVersion="17" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.Main"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.AreaConvert"
|
||||
android:label="@string/title_activity_area_convert" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.CurrencyConvert"
|
||||
android:label="@string/title_activity_currency_convert" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.LengthConvert"
|
||||
android:label="@string/title_activity_length_convert" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.VolumeConvert"
|
||||
android:label="@string/title_activity_volume_convert" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.WeightConvert"
|
||||
android:label="@string/title_activity_weight_convert" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.AnglesConvert"
|
||||
android:label="@string/title_activity_angles_convert" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.GasMileage"
|
||||
android:label="@string/title_activity_gas_mileage" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.TemperatureConvert"
|
||||
android:label="@string/title_activity_temperature_convert" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.SpeedConvert"
|
||||
android:label="@string/title_activity_speed_convert" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.NumbersConvert"
|
||||
android:label="@string/title_activity_numbers_convert" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="missioncollege.cis063.unitsconverter.Calculator"
|
||||
android:label="@string/title_activity_calculator" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,79 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class AnglesConvert extends Activity {
|
||||
Spinner anglesSpinner;
|
||||
EditText anglesEdit;
|
||||
TextView [] tvAngles = new TextView[2];
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.angles);
|
||||
anglesSpinner = (Spinner) findViewById(R.id.spnAngles);
|
||||
anglesEdit = (EditText) findViewById(R.id.editAngles);
|
||||
tvAngles[0] = (TextView) findViewById(R.id.txtValueAngles0);
|
||||
tvAngles[1] = (TextView) findViewById(R.id.txtValueAngles1);
|
||||
|
||||
anglesEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
anglesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.angles_convert, menu);
|
||||
return true;
|
||||
}
|
||||
public void update() {
|
||||
int sigFig = 5; // significant figures displayed
|
||||
if (anglesEdit.getText().toString().length() > 0) {
|
||||
double value = Double.parseDouble(anglesEdit.getText().toString());
|
||||
int fromUnits = anglesSpinner.getSelectedItemPosition();
|
||||
for (int i = 0; i < tvAngles.length; i++) {
|
||||
tvAngles[i].setText(String.valueOf(clipNumber(convert(value, fromUnits, i), sigFig)));
|
||||
}
|
||||
}
|
||||
}
|
||||
public double convert (double size, int fromUnits, int toUnits) {
|
||||
// 0=degrees, 1=radians
|
||||
final double[] conv = {1.0, 57.2957795};
|
||||
return size * conv[fromUnits] / conv[toUnits];
|
||||
}
|
||||
public static double clipNumber(double num, int n) {
|
||||
// num is the number; n is number of significant figures returned
|
||||
if(num == 0)
|
||||
return 0;
|
||||
|
||||
final double d = Math.ceil(Math.log10(num < 0 ? -num: num));
|
||||
final int power = n - (int) d;
|
||||
|
||||
final double magnitude = Math.pow(10, power);
|
||||
final long shifted = Math.round(num*magnitude);
|
||||
return shifted/magnitude;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class AreaConvert extends Activity {
|
||||
Spinner areaSpinner;
|
||||
EditText areaEdit;
|
||||
TextView[] tvArea = new TextView[9];
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.area);
|
||||
areaSpinner = (Spinner) findViewById(R.id.spnArea);
|
||||
areaEdit = (EditText) findViewById(R.id.editArea);
|
||||
|
||||
tvArea[0] = (TextView) findViewById(R.id.txtValueAre0);
|
||||
tvArea[1] = (TextView) findViewById(R.id.txtValueAre1);
|
||||
tvArea[2] = (TextView) findViewById(R.id.txtValueAre2);
|
||||
tvArea[3] = (TextView) findViewById(R.id.txtValueAre3);
|
||||
tvArea[4] = (TextView) findViewById(R.id.txtValueAre4);
|
||||
tvArea[5] = (TextView) findViewById(R.id.txtValueAre5);
|
||||
tvArea[6] = (TextView) findViewById(R.id.txtValueAre6);
|
||||
tvArea[7] = (TextView) findViewById(R.id.txtValueAre7);
|
||||
tvArea[8] = (TextView) findViewById(R.id.txtValueAre8);
|
||||
|
||||
areaEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
areaSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.area_convert, menu);
|
||||
return true;
|
||||
}
|
||||
public double convert (double size, int fromUnits, int toUnits) {
|
||||
// 0=sqInches, 1=sqFeet, 2=sqMiles, 3=sqMM, 4=sqM, 5=sqKM, 6=Acres, 7=Hectares, 8=Ping
|
||||
final double[] conv = {1.0, 144.0, 4014489599.9, .0015500031, 1550.003, 1550003100.0, 6272640.0, 15500031.0, 5122.76};
|
||||
return size * conv[fromUnits] / conv[toUnits];
|
||||
}
|
||||
public void update() {
|
||||
int sigFig = 5; // significant figures displayed
|
||||
if (areaEdit.getText().toString().length() > 0) {
|
||||
double value = Double.parseDouble(areaEdit.getText().toString());
|
||||
int fromUnits = areaSpinner.getSelectedItemPosition();
|
||||
for (int i = 0; i < tvArea.length; i++) {
|
||||
tvArea[i].setText(String.valueOf(clipNumber(convert(value, fromUnits, i), sigFig)));
|
||||
}
|
||||
}
|
||||
}
|
||||
public static double clipNumber(double num, int n) {
|
||||
// num is the number; n is number of significant figures returned
|
||||
if(num == 0)
|
||||
return 0;
|
||||
|
||||
final double d = Math.ceil(Math.log10(num < 0 ? -num: num));
|
||||
final int power = n - (int) d;
|
||||
|
||||
final double magnitude = Math.pow(10, power);
|
||||
final long shifted = Math.round(num*magnitude);
|
||||
return shifted/magnitude;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,470 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Calculator extends Activity {
|
||||
TextView textCalculator, textCalcBreadcrumbs;
|
||||
int operation = -1;
|
||||
double num1, num2, result, memory1 = 0;
|
||||
boolean num1isSet = false;
|
||||
// boolean num2isSet = false;
|
||||
boolean clearScreen = false;
|
||||
static int MAX_LENGTH = 14;
|
||||
static double MAX_NUM = 1000000000000d;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.calculator);
|
||||
textCalculator = (TextView) findViewById(R.id.txtCalculator);
|
||||
textCalcBreadcrumbs = (TextView) findViewById(R.id.txtCalcBreadcrumbs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.calculator, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
// M+
|
||||
public void clickMplus (View v) {
|
||||
if (hasNumber()) {
|
||||
memory1 = memory1 + getNumber();
|
||||
clearScreen = true;
|
||||
}
|
||||
}
|
||||
// M-
|
||||
public void clickMminus (View v) {
|
||||
if (hasNumber()) {
|
||||
memory1 = memory1 - getNumber();
|
||||
clearScreen = true;
|
||||
}
|
||||
}
|
||||
// MR
|
||||
public void clickMR (View v) {
|
||||
textCalculator.setText("" + memory1);
|
||||
clearScreen = true;
|
||||
}
|
||||
// MC
|
||||
public void clickMC (View v) {
|
||||
memory1 = 0;
|
||||
}
|
||||
public void clickClear(View v) {
|
||||
clear();
|
||||
}
|
||||
|
||||
public void clickSin (View v) {
|
||||
double temp;
|
||||
String s;
|
||||
if (hasNumber()) {
|
||||
temp = getNumber();
|
||||
s = "" + round(Math.sin(temp));
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText("sin(" + Double.toString(temp) + ")");
|
||||
}
|
||||
clearScreen = true;
|
||||
}
|
||||
public void clickCos (View v) {
|
||||
double temp;
|
||||
String s;
|
||||
if (hasNumber()) {
|
||||
temp = getNumber();
|
||||
s = "" + round(Math.cos(temp));
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText("cos(" + Double.toString(temp) + ")");
|
||||
}
|
||||
clearScreen = true;
|
||||
}
|
||||
public void clickTan (View v) {
|
||||
double temp;
|
||||
String s;
|
||||
if (hasNumber()) {
|
||||
temp = getNumber();
|
||||
s = "" + round(Math.tan(temp));
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText("tan(" + Double.toString(temp) + ")");
|
||||
}
|
||||
clearScreen = true;
|
||||
}
|
||||
public void clickRoot (View v) {
|
||||
double temp;
|
||||
String s;
|
||||
if (hasNumber()) {
|
||||
temp = getNumber();
|
||||
if (temp > 0) {
|
||||
s = "" + round(Math.sqrt(temp));
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText("sqrt(" + Double.toString(temp) + ")");
|
||||
}
|
||||
else {
|
||||
clear();
|
||||
textCalculator.setText("Error");
|
||||
}
|
||||
}
|
||||
clearScreen = true;
|
||||
}
|
||||
public void clickDel (View v) {
|
||||
String temp;
|
||||
if (hasNumber()) {
|
||||
temp = textCalculator.getText().toString();
|
||||
textCalculator.setText("" + temp.substring(0, temp.length() - 1));
|
||||
}
|
||||
else
|
||||
clear();
|
||||
}
|
||||
|
||||
public void clickAbs (View v) {
|
||||
double temp;
|
||||
String s;
|
||||
if (hasNumber()) {
|
||||
temp = getNumber();
|
||||
s = "" + round(Math.abs(temp));
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText("|" + Double.toString(temp) + "|");
|
||||
}
|
||||
clearScreen = true;
|
||||
}
|
||||
public void clickLn (View v) {
|
||||
double temp;
|
||||
String s;
|
||||
if (hasNumber()) {
|
||||
temp = getNumber();
|
||||
s = "" + round(Math.log(temp));
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText("ln(" + Double.toString(temp) + ")");
|
||||
}
|
||||
clearScreen = true;
|
||||
}
|
||||
public void clickLog10 (View v) {
|
||||
double temp;
|
||||
String s;
|
||||
if (hasNumber()) {
|
||||
temp = getNumber();
|
||||
s = "" + round(Math.log10(temp));
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText("log10(" + Double.toString(temp) + ")");
|
||||
}
|
||||
clearScreen = true;
|
||||
}
|
||||
public void clickE (View v) {
|
||||
String s = "" + round(Math.E);
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText("e");
|
||||
clearScreen = true;
|
||||
}
|
||||
public void clickTbd (View v) { }
|
||||
|
||||
public void clickGcf (View v) {
|
||||
performOperation();
|
||||
operation = 4;
|
||||
}
|
||||
public void clickLcm (View v) {
|
||||
performOperation();
|
||||
operation = 5;
|
||||
}
|
||||
public void clickPrime(View v) {
|
||||
String isPrime = "Prime";
|
||||
if (hasNumber()) {
|
||||
long num = (long)getNumber();
|
||||
for (long x = 2; x < (long)Math.sqrt(num) + 1; x++) {
|
||||
if (num % x == 0) {
|
||||
isPrime = "Not Prime";
|
||||
break;
|
||||
}
|
||||
}
|
||||
textCalculator.setText(isPrime);
|
||||
textCalcBreadcrumbs.setText("prime?(" + Double.toString(num) + ")");
|
||||
clearScreen = true;
|
||||
}
|
||||
}
|
||||
public void clickPi (View v) {
|
||||
String s = "" + round(Math.PI);
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText("\u03C0");
|
||||
clearScreen = true;
|
||||
}
|
||||
// x^y
|
||||
public void clickPower (View v) {
|
||||
performOperation();
|
||||
operation = 6;
|
||||
}
|
||||
|
||||
// x^2
|
||||
public void clickSquare (View v) {
|
||||
double temp;
|
||||
String s;
|
||||
if (hasNumber()) {
|
||||
temp = getNumber();
|
||||
s = "" + round(temp * temp);
|
||||
textCalculator.setText(s);
|
||||
textCalcBreadcrumbs.setText(Double.toString(temp) + " ^2");
|
||||
clearScreen = true;
|
||||
}
|
||||
}
|
||||
// 1/x
|
||||
public void clickInverse(View v) {
|
||||
if (hasNumber()) {
|
||||
double num = getNumber();
|
||||
textCalculator.setText("" + round(1 / num));
|
||||
textCalcBreadcrumbs.setText("1/" + num);
|
||||
clearScreen = true;
|
||||
}
|
||||
}
|
||||
// %
|
||||
public void clickPercent(View v) {
|
||||
if (hasNumber()) {
|
||||
double num = getNumber();
|
||||
textCalculator.setText("" + (0.01 * num));
|
||||
textCalcBreadcrumbs.setText("" + num + "%");
|
||||
clearScreen = true;
|
||||
}
|
||||
}
|
||||
public void clickEquals(View v) {
|
||||
if (hasNumber()) {
|
||||
num2 = getNumber();
|
||||
getResult();
|
||||
textCalculator.setText("" + result);
|
||||
num1isSet = false;
|
||||
num2 = result = 0;
|
||||
operation = -1;
|
||||
clearScreen = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void click0 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("0");
|
||||
else {
|
||||
textCalculator.setText("0");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
public void click1 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("1");
|
||||
else {
|
||||
textCalculator.setText("1");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
public void click2 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("2");
|
||||
else {
|
||||
textCalculator.setText("2");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
public void click3 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("3");
|
||||
else {
|
||||
textCalculator.setText("3");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
public void click4 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("4");
|
||||
else {
|
||||
textCalculator.setText("4");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
public void click5 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("5");
|
||||
else {
|
||||
textCalculator.setText("5");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
public void click6 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("6");
|
||||
else {
|
||||
textCalculator.setText("6");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
public void click7 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("7");
|
||||
else {
|
||||
textCalculator.setText("7");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
public void click8 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("8");
|
||||
else {
|
||||
textCalculator.setText("8");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
public void click9 (View v) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append("9");
|
||||
else {
|
||||
textCalculator.setText("9");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
// only append a dot if the current display does not contain a dot
|
||||
public void clickDot (View v) {
|
||||
if (!textCalculator.getText().toString().contains(".")) {
|
||||
if (!clearScreen)
|
||||
textCalculator.append(".");
|
||||
else {
|
||||
textCalculator.setText(".");
|
||||
clearScreen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void clickPosNeg (View v) {
|
||||
double temp;
|
||||
if (textCalculator.getText().length() > 0) {
|
||||
temp = Double.parseDouble(textCalculator.getText().toString());
|
||||
textCalculator.setText("" + (-1 * temp));
|
||||
}
|
||||
}
|
||||
|
||||
public void clickAdd(View v) {
|
||||
performOperation();
|
||||
operation = 0;
|
||||
}
|
||||
public void clickSubtract(View v) {
|
||||
performOperation();
|
||||
operation = 1;
|
||||
}
|
||||
public void clickMultiply(View v) {
|
||||
performOperation();
|
||||
operation = 2;
|
||||
}
|
||||
public void clickDivide(View v) {
|
||||
performOperation();
|
||||
operation = 3;
|
||||
}
|
||||
// perform operations with two numbers
|
||||
public void performOperation () {
|
||||
if (num1isSet) {
|
||||
if (hasNumber()) {
|
||||
num2 = getNumber();
|
||||
getResult();
|
||||
num1 = result;
|
||||
num2 = 0;
|
||||
textCalculator.setText("" + result);
|
||||
}
|
||||
else {
|
||||
clear();
|
||||
textCalculator.setText("ERROR");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (hasNumber()) {
|
||||
num1 = getNumber();
|
||||
num1isSet = true;
|
||||
}
|
||||
else {
|
||||
clear();
|
||||
textCalculator.setText("ERROR");
|
||||
}
|
||||
}
|
||||
clearScreen = true;
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
num1 = num2 = result = 0;
|
||||
operation = -1;
|
||||
num1isSet = false;
|
||||
textCalculator.setText("");
|
||||
textCalcBreadcrumbs.setText("");
|
||||
}
|
||||
// works with performOperation to do operations with two numbers
|
||||
private void getResult() {
|
||||
switch (operation) {
|
||||
case 0: // add
|
||||
result = num1 + num2;
|
||||
textCalcBreadcrumbs.setText("" + num1 + "+" + num2 + "=");
|
||||
break;
|
||||
case 1: // subtract
|
||||
result = num1 - num2;
|
||||
textCalcBreadcrumbs.setText("" + num1 + "-" + num2 + "=");
|
||||
break;
|
||||
case 2: // multiply
|
||||
result = num1 * num2;
|
||||
textCalcBreadcrumbs.setText("" + num1 + "x" + num2 + "=");
|
||||
break;
|
||||
case 3: // divide
|
||||
if (num2 != 0) {
|
||||
result = num1 / num2;
|
||||
textCalcBreadcrumbs.setText("" + num1 + "\u00F7" + num2 + "=");
|
||||
}
|
||||
else
|
||||
result = 0;
|
||||
break;
|
||||
case 4: // gcf
|
||||
result = 1;
|
||||
if (((int)num1 < num1 + 0.01) && ((int)num2 < num2 + 0.01)) {
|
||||
for (int i = 1; i <= (int) num1 && i <= (int) num2; ++i) {
|
||||
if ((int) num1 % i == 0 && (int) num2 % i == 0) {
|
||||
result = i;
|
||||
}
|
||||
}
|
||||
textCalcBreadcrumbs.setText("lcm(" + num1 + ", " + num2 + ")=");
|
||||
}
|
||||
break;
|
||||
case 5: // lcm
|
||||
int gcf = 1;
|
||||
if (((int)num1 < num1 + 0.01) && ((int)num2 < num2 + 0.01)) {
|
||||
for (int i = 1; i <= (int) num1 && i <= (int) num2; ++i) {
|
||||
if ((int) num1 % i == 0 && (int) num2 % i == 0) {
|
||||
gcf = i;
|
||||
}
|
||||
}
|
||||
result = ((int)num1 * (int)num2) / gcf;
|
||||
textCalcBreadcrumbs.setText("lcm(" + num1 + ", " + num2 + ")=");
|
||||
}
|
||||
break;
|
||||
case 6: // x^y
|
||||
result = Math.pow(num1, num2);
|
||||
textCalcBreadcrumbs.setText("" + num1 + "^" + num2 + "=");
|
||||
break;
|
||||
default:
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
private boolean hasNumber() {
|
||||
if (textCalculator.getText().length() > 0) {
|
||||
try {
|
||||
Double.parseDouble(textCalculator.getText().toString());
|
||||
}
|
||||
catch(NumberFormatException nfe) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private double getNumber() {
|
||||
return Double.parseDouble(textCalculator.getText().toString());
|
||||
}
|
||||
private String trim (String s) {
|
||||
if (s.length() > MAX_LENGTH && s.indexOf("E") < 0) {
|
||||
return s.substring(0, MAX_LENGTH);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
private double round (double num) {
|
||||
String text = Double.toString(Math.abs(num));
|
||||
double integerPlaces = text.indexOf(".");
|
||||
double roundPlaces = MAX_NUM / Math.pow(10, integerPlaces);
|
||||
return (double) Math.round(num * roundPlaces) / roundPlaces;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
public class CurrencyConvert extends Activity {
|
||||
Spinner currencySpinner;
|
||||
EditText currencyEdit;
|
||||
TextView[] tvCurrency = new TextView[8];
|
||||
ProgressBar progressBar;
|
||||
String[] units = {"USD_USD", "EUR_USD", "GBP_USD", "JPY_USD", "CAD_USD", "CNY_USD", "AUD_USD", "MXN_USD"};
|
||||
double[] conv = new double[8];
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.currency);
|
||||
currencySpinner = (Spinner) findViewById(R.id.spnCurrency);
|
||||
currencyEdit = (EditText) findViewById(R.id.editCurrency);
|
||||
progressBar = (ProgressBar) findViewById(R.id.progressBar);
|
||||
|
||||
tvCurrency[0] = (TextView) findViewById(R.id.txtValueCurrency0);
|
||||
tvCurrency[1] = (TextView) findViewById(R.id.txtValueCurrency1);
|
||||
tvCurrency[2] = (TextView) findViewById(R.id.txtValueCurrency2);
|
||||
tvCurrency[3] = (TextView) findViewById(R.id.txtValueCurrency3);
|
||||
tvCurrency[4] = (TextView) findViewById(R.id.txtValueCurrency4);
|
||||
tvCurrency[5] = (TextView) findViewById(R.id.txtValueCurrency5);
|
||||
tvCurrency[6] = (TextView) findViewById(R.id.txtValueCurrency6);
|
||||
tvCurrency[7] = (TextView) findViewById(R.id.txtValueCurrency7);
|
||||
new RetrieveRates().execute("");
|
||||
conv[0] = 1.0;
|
||||
|
||||
currencyEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
currencySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.currency_convert, menu);
|
||||
return true;
|
||||
}
|
||||
public double convert (double size, int fromUnits, int toUnits) {
|
||||
return size * conv[fromUnits] / conv[toUnits];
|
||||
}
|
||||
public void update() {
|
||||
if (currencyEdit.getText().toString().length() > 0) {
|
||||
double value = Double.parseDouble(currencyEdit.getText().toString());
|
||||
int fromUnits = currencySpinner.getSelectedItemPosition();
|
||||
for (int i = 0; i < tvCurrency.length; i++) {
|
||||
tvCurrency[i].setText(String.valueOf(round(convert(value, fromUnits, i))));
|
||||
}
|
||||
}
|
||||
}
|
||||
public static double round(double num) {
|
||||
return (Math.round(num * 100.0))/100.0;
|
||||
}
|
||||
class RetrieveRates extends AsyncTask<String, String, String> {
|
||||
private Exception exception;
|
||||
protected void onPreExecute() {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
tvCurrency[3].setText("");
|
||||
}
|
||||
protected String doInBackground(String... args) {
|
||||
for (int i = 1; i < units.length; i++) {
|
||||
try {
|
||||
URL url = new URL("http://free.currencyconverterapi.com/api/v5/convert?q=" + units[i] + "&compact=y");
|
||||
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
stringBuilder.append(line).append("\n");
|
||||
}
|
||||
bufferedReader.close();
|
||||
String s = stringBuilder.toString();
|
||||
int start = s.indexOf("{\"val\":") + 7;
|
||||
int end = s.indexOf("}");
|
||||
conv[i] = Double.parseDouble(s.substring(start, end));
|
||||
}
|
||||
finally{
|
||||
urlConnection.disconnect();
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.e("ERROR", e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
protected void onPostExecute(String response) {
|
||||
if(response == null) {
|
||||
response = "THERE WAS AN ERROR";
|
||||
}
|
||||
progressBar.setVisibility(View.GONE);
|
||||
Log.i("INFO", response);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class GasMileage extends Activity {
|
||||
Spinner gasMileageSpinner;
|
||||
EditText gasMileageEdit;
|
||||
TextView [] tvGasMileage = new TextView[2];
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.gas_mileage);
|
||||
gasMileageSpinner = (Spinner) findViewById(R.id.spnGasMileage);
|
||||
gasMileageEdit = (EditText) findViewById(R.id.editGasMileage);
|
||||
tvGasMileage[0] = (TextView) findViewById(R.id.txtValueGasMileage0);
|
||||
tvGasMileage[1] = (TextView) findViewById(R.id.txtValueGasMileage1);
|
||||
|
||||
gasMileageEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
gasMileageSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.gas_mileage, menu);
|
||||
return true;
|
||||
}
|
||||
public void update() {
|
||||
int sigFig = 5; // significant figures displayed
|
||||
if (gasMileageEdit.getText().toString().length() > 0) {
|
||||
double value = Double.parseDouble(gasMileageEdit.getText().toString());
|
||||
int fromUnits = gasMileageSpinner.getSelectedItemPosition();
|
||||
for (int i = 0; i < tvGasMileage.length; i++) {
|
||||
tvGasMileage[i].setText(String.valueOf(clipNumber(convert(value, fromUnits, i), sigFig)));
|
||||
}
|
||||
}
|
||||
}
|
||||
public double convert (double size, int fromUnits, int toUnits) {
|
||||
// 0=mpg, 1=km per liter
|
||||
final double [] conv = {1.0, 2.3521458};
|
||||
return size * conv[fromUnits] / conv[toUnits];
|
||||
}
|
||||
public static double clipNumber(double num, int n) {
|
||||
// num is the number; n is number of significant figures returned
|
||||
if(num == 0)
|
||||
return 0;
|
||||
|
||||
final double d = Math.ceil(Math.log10(num < 0 ? -num: num));
|
||||
final int power = n - (int) d;
|
||||
|
||||
final double magnitude = Math.pow(10, power);
|
||||
final long shifted = Math.round(num*magnitude);
|
||||
return shifted/magnitude;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.Editable;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
public class LengthConvert extends Activity {
|
||||
Spinner lengthSpinner;
|
||||
EditText lengthEdit;
|
||||
TextView[] tvLength = new TextView[9];
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.length);
|
||||
lengthSpinner = (Spinner) findViewById(R.id.spnLength);
|
||||
lengthEdit = (EditText) findViewById(R.id.editLength);
|
||||
|
||||
tvLength[0] = (TextView) findViewById(R.id.txtValueLength0);
|
||||
tvLength[1] = (TextView) findViewById(R.id.txtValueLength1);
|
||||
tvLength[2] = (TextView) findViewById(R.id.txtValueLength2);
|
||||
tvLength[3] = (TextView) findViewById(R.id.txtValueLength3);
|
||||
tvLength[4] = (TextView) findViewById(R.id.txtValueLength4);
|
||||
tvLength[5] = (TextView) findViewById(R.id.txtValueLength5);
|
||||
tvLength[6] = (TextView) findViewById(R.id.txtValueLength6);
|
||||
tvLength[7] = (TextView) findViewById(R.id.txtValueLength7);
|
||||
tvLength[8] = (TextView) findViewById(R.id.txtValueLength8);
|
||||
|
||||
lengthEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
lengthSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.length_convert, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
int sigFig = 5; // significant figures displayed
|
||||
if (lengthEdit.getText().toString().length() > 0) {
|
||||
double value = Double.parseDouble(lengthEdit.getText().toString());
|
||||
int fromUnits = lengthSpinner.getSelectedItemPosition();
|
||||
for (int i = 0; i < tvLength.length; i++) {
|
||||
tvLength[i].setText(String.valueOf(clipNumber(convert(value, fromUnits, i), sigFig)));
|
||||
}
|
||||
}
|
||||
}
|
||||
public double convert (double size, int fromUnits, int toUnits) {
|
||||
//conversion uses indexes: 0=inches, 1=feet, 2=yards, 3=miles, 4=mm, 5=cm, 6=m, 7=km, 8=nauts
|
||||
final double [] conv = {1.0, 12.0, 36.0, 63360.0, .0393701, .393701, 39.3701, 39370.1, 72913.39};
|
||||
return size * conv[fromUnits] / conv[toUnits];
|
||||
}
|
||||
public static double clipNumber(double num, int n) {
|
||||
// num is the number; n is number of significant figures returned
|
||||
if(num == 0)
|
||||
return 0;
|
||||
|
||||
final double d = Math.ceil(Math.log10(num < 0 ? -num: num));
|
||||
final int power = n - (int) d;
|
||||
|
||||
final double magnitude = Math.pow(10, power);
|
||||
final long shifted = Math.round(num*magnitude);
|
||||
return shifted/magnitude;
|
||||
}
|
||||
}
|
||||
90
src/main/java/missioncollege/cis063/unitsconverter/Main.java
Normal file
@@ -0,0 +1,90 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class Main extends ListActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// setContentView(R.layout.main);
|
||||
String[] categories = {"Angles", "Area", "Calculator", "Currency", "Gas Mileage", "Length/Distance",
|
||||
"Number Systems", "Speed", "Temperature", "Volume", "Weight"};
|
||||
setListAdapter(new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_list_item_1, categories));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
// Intent i = new Intent(this, Convert.class);
|
||||
// i.putExtra("position", position);
|
||||
// startActivity(i);
|
||||
Intent i;
|
||||
switch (position) {
|
||||
case 0:
|
||||
i = new Intent(this, AnglesConvert.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
case 1:
|
||||
i = new Intent(this, AreaConvert.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
case 2:
|
||||
i = new Intent(this, Calculator.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
case 3:
|
||||
i = new Intent(this, CurrencyConvert.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
case 4:
|
||||
i = new Intent(this, GasMileage.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
case 5:
|
||||
i = new Intent(this, LengthConvert.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
case 6:
|
||||
i = new Intent(this, NumbersConvert.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
case 7:
|
||||
i = new Intent(this, SpeedConvert.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
case 8:
|
||||
i = new Intent(this, TemperatureConvert.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
/*case 8:
|
||||
i = new Intent(this, TimeConvert.class);
|
||||
startActivity(i);
|
||||
break;*/
|
||||
case 9:
|
||||
i = new Intent(this, VolumeConvert.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
case 10:
|
||||
i = new Intent(this, WeightConvert.class);
|
||||
startActivity(i);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class NumbersConvert extends Activity {
|
||||
EditText numberEdit;
|
||||
Spinner numberSpinner;
|
||||
TextView tvDecimal, tvBinary, tvOctal, tvHex, tvRoman;
|
||||
int intNumber;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.numbers);
|
||||
numberEdit = (EditText)findViewById(R.id.txtNumber);
|
||||
numberSpinner = (Spinner)findViewById(R.id.spnNumbers);
|
||||
tvDecimal = (TextView)findViewById(R.id.txtDec);
|
||||
tvBinary = (TextView)findViewById(R.id.txtBi);
|
||||
tvOctal = (TextView)findViewById(R.id.txtOct);
|
||||
tvHex = (TextView)findViewById(R.id.txtHex);
|
||||
tvRoman = (TextView)findViewById(R.id.txtRoman);
|
||||
|
||||
numberEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
numberSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.numbers_convert, menu);
|
||||
return true;
|
||||
}
|
||||
public void update() {
|
||||
int fromUnits = numberSpinner.getSelectedItemPosition();
|
||||
String strValue;
|
||||
if (numberEdit.getText().toString().length() > 0) {
|
||||
strValue = numberEdit.getText().toString();
|
||||
|
||||
switch (fromUnits) {
|
||||
case 0:
|
||||
intNumber = getInt(strValue, 10);
|
||||
break;
|
||||
|
||||
case 1: // Binary
|
||||
intNumber = getInt(strValue, 2);
|
||||
break;
|
||||
|
||||
case 2: // Octal
|
||||
intNumber = getInt(strValue, 8);
|
||||
break;
|
||||
|
||||
case 3: // Hexadecimal
|
||||
intNumber = getInt(strValue, 16);
|
||||
break;
|
||||
case 4: // Roman Numerals
|
||||
if (isRoman(strValue)) {
|
||||
intNumber = romanToArabic(strValue);
|
||||
showResult(intNumber);
|
||||
}
|
||||
else
|
||||
showError();
|
||||
break;
|
||||
}
|
||||
if (intNumber > 0)
|
||||
showResult(intNumber);
|
||||
else
|
||||
showError();
|
||||
}
|
||||
}
|
||||
public int getInt(String s, int base) {
|
||||
try { return Integer.parseInt(s, base); }
|
||||
catch (Exception e) { showError(); }
|
||||
return -1;
|
||||
}
|
||||
public void showResult(int decNumber) {
|
||||
tvDecimal.setText(Integer.toString(decNumber));
|
||||
tvBinary.setText(Integer.toBinaryString(decNumber));
|
||||
tvOctal.setText(Integer.toOctalString(decNumber));
|
||||
tvHex.setText(Integer.toHexString(decNumber));
|
||||
tvRoman.setText(toRoman(decNumber));
|
||||
}
|
||||
public void showError() {
|
||||
tvDecimal.setText("Invalid input.");
|
||||
tvBinary.setText("Invalid input.");
|
||||
tvOctal.setText("Invalid input.");
|
||||
tvHex.setText("Invalid input.");
|
||||
tvRoman.setText("Invalid input.");
|
||||
}
|
||||
|
||||
// *** Roman Numeral specific methods
|
||||
|
||||
enum Numeral {
|
||||
I(1), IV(4), V(5), IX(9), X(10), XL(40), L(50), XC(90), C(100), CD(400), D(500), CM(900), M(1000), ;
|
||||
int weight;
|
||||
|
||||
Numeral(int weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
};
|
||||
|
||||
public static String toRoman(long n) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
final Numeral[] values = Numeral.values();
|
||||
for (int i = values.length - 1; i >= 0; i--) {
|
||||
while (n >= values[i].weight) {
|
||||
buf.append(values[i]);
|
||||
n -= values[i].weight;
|
||||
}
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
// New code for Roman Numeral conversion to Arabic
|
||||
|
||||
enum Roman {
|
||||
I(1,'I'), V(5,'V'), X(10,'X'), L(50,'L'), C(100,'C'), D(500,'D'), M(1000,'M'), ;
|
||||
int aNumeral;
|
||||
char rNumeral;
|
||||
|
||||
Roman(int aNumeral, char rNumeral) { // Constructor
|
||||
this.aNumeral = aNumeral;
|
||||
this.rNumeral = rNumeral;
|
||||
}
|
||||
};
|
||||
|
||||
// String is a valid Roman numeral
|
||||
public static boolean isRoman(String s) {
|
||||
if (s.length() < 1) { // Rule 1: Cannot be blank
|
||||
return false;
|
||||
}
|
||||
if ( !isRomanNumChar(s) ) {
|
||||
return false;
|
||||
}
|
||||
if ( !isRomanSeq(s) ) {
|
||||
return false;
|
||||
}
|
||||
return true; // All tests were passed
|
||||
} // End isRoman
|
||||
|
||||
public static boolean isRomanNumChar(String s) {
|
||||
final Roman[] values = Roman.values();
|
||||
int sChars = s.length()-1; // Max character position number
|
||||
int rChars = values.length-1; // Max character element number
|
||||
|
||||
for (int j = sChars; j >= 0; j-- ) {// Progress backwards
|
||||
for (int i = 0; i <= rChars; i++ ) { // Progress from I to V to X, ...
|
||||
if ( values[i].rNumeral == s.charAt(j) ){
|
||||
i = rChars; // Leave for i loop
|
||||
} else if ( i == rChars ) { // String char not a valid Roman numeral
|
||||
//System.out.printf( "\n\"%s\" is not a valid Roman numeral character.\n",
|
||||
// s.charAt(j) );
|
||||
return false;
|
||||
}
|
||||
} // End for i
|
||||
} // End for j
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isRomanSeq(String s) {
|
||||
final Roman[] values = Roman.values();
|
||||
int sChars = s.length()-1; // Max character position number
|
||||
int rChars = values.length-1; // Max character element number
|
||||
int curr =0;
|
||||
int prev1=0;
|
||||
int prev2=0;
|
||||
int prev3=0;
|
||||
|
||||
for (int j = sChars; j >= 0; j-- ) {// Progress backwards
|
||||
for (int i = 0; i <= rChars; i++ ) { // Progress from I to V to X, ...
|
||||
if ( values[i].rNumeral == s.charAt(j) ){
|
||||
prev3 = prev2;
|
||||
prev2 = prev1;
|
||||
prev1 = curr;
|
||||
curr = values[i].aNumeral;
|
||||
switch(curr) {
|
||||
case 1:
|
||||
case 10:
|
||||
case 100:
|
||||
case 1000:
|
||||
if ( curr + prev1 + prev2 + prev3 == curr * 4 ) { // Ex: IIII
|
||||
return false;
|
||||
} else if ( curr == prev2 && curr < prev1) { // Ex: IVI
|
||||
return false;
|
||||
} else if ( curr == prev1 && curr < prev2 ) { // EX: IIV
|
||||
return false;
|
||||
} else if ( curr + prev1 >= curr + ( curr * 50 ) ) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case 50:
|
||||
case 500:
|
||||
case 5000:
|
||||
if ( curr + prev1 > 6 * (curr / 5) ) { // Ex: VI, LX is max allowable value
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
} // End switch
|
||||
} // End if
|
||||
} // End i loop
|
||||
} // End j loop
|
||||
return true;
|
||||
} // End isRomanSeq
|
||||
|
||||
public static int romanToArabic(String s) {
|
||||
final Roman[] values = Roman.values();
|
||||
int sChars = s.length()-1; // Max character position number
|
||||
int rChars = values.length-1; // Max character element number
|
||||
int curr = 0;
|
||||
int prev1 = 0;
|
||||
int arabicNum = 0;
|
||||
for (int j = sChars; j >= 0; j-- ) {// Progress backwards
|
||||
for (int i = 0; i <= rChars; i++ ) { // Progress from I to V to X, ...
|
||||
if ( values[i].rNumeral == s.charAt(j) ){
|
||||
prev1 = curr;
|
||||
curr = values[i].aNumeral;
|
||||
if ( curr >= prev1 ) {
|
||||
arabicNum += curr;
|
||||
} else {
|
||||
arabicNum -= curr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return arabicNum;
|
||||
}
|
||||
// end new code for Roman Numerals
|
||||
} // End Class
|
||||
@@ -0,0 +1,86 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class SpeedConvert extends Activity {
|
||||
Spinner speedSpinner;
|
||||
EditText speedEdit;
|
||||
TextView[] tvSpeed = new TextView[8];
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.speed);
|
||||
speedSpinner = (Spinner) findViewById(R.id.spnSpeed);
|
||||
speedEdit = (EditText) findViewById(R.id.editSpeed);
|
||||
|
||||
tvSpeed[0] = (TextView) findViewById(R.id.txtValueSpeed0);
|
||||
tvSpeed[1] = (TextView) findViewById(R.id.txtValueSpeed1);
|
||||
tvSpeed[2] = (TextView) findViewById(R.id.txtValueSpeed2);
|
||||
tvSpeed[3] = (TextView) findViewById(R.id.txtValueSpeed3);
|
||||
tvSpeed[4] = (TextView) findViewById(R.id.txtValueSpeed4);
|
||||
tvSpeed[5] = (TextView) findViewById(R.id.txtValueSpeed5);
|
||||
tvSpeed[6] = (TextView) findViewById(R.id.txtValueSpeed6);
|
||||
tvSpeed[7] = (TextView) findViewById(R.id.txtValueSpeed7);
|
||||
|
||||
speedEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
speedSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.speed_convert, menu);
|
||||
return true;
|
||||
}
|
||||
public void update() {
|
||||
int sigFig = 5; // significant figures displayed
|
||||
if (speedEdit.getText().toString().length() > 0) {
|
||||
double value = Double.parseDouble(speedEdit.getText().toString());
|
||||
int fromUnits = speedSpinner.getSelectedItemPosition();
|
||||
for (int i = 0; i < tvSpeed.length; i++) {
|
||||
tvSpeed[i].setText(String.valueOf(clipNumber(convert(value, fromUnits, i), sigFig)));
|
||||
}
|
||||
}
|
||||
}
|
||||
public double convert (double size, int fromUnits, int toUnits) {
|
||||
// 0=InPerSec, 1=FeetPerSec, 2=MPH, 3=cmPerSec, 4=mPerSec, 5=kmPerHr, 6=Knots, 7=Mach
|
||||
final double[] conv = {1.0, 12.0, 17.6, .393700787, 39.3700787, 10.93613298, 20.2537183, 13397.2441};
|
||||
return size * conv[fromUnits] / conv[toUnits];
|
||||
}
|
||||
public static double clipNumber(double num, int n) {
|
||||
// num is the number; n is number of significant figures returned
|
||||
if(num == 0)
|
||||
return 0;
|
||||
|
||||
final double d = Math.ceil(Math.log10(num < 0 ? -num: num));
|
||||
final int power = n - (int) d;
|
||||
|
||||
final double magnitude = Math.pow(10, power);
|
||||
final long shifted = Math.round(num*magnitude);
|
||||
return shifted/magnitude;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class TemperatureConvert extends Activity {
|
||||
Spinner temperatureSpinner;
|
||||
EditText temperatureEdit;
|
||||
TextView [] tvTemperature = new TextView[3];
|
||||
//TextView textValueTemperature0, textValueTemperature1, textValueTemperature2;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.temperature);
|
||||
temperatureSpinner = (Spinner) findViewById(R.id.spnTemperature);
|
||||
temperatureEdit = (EditText) findViewById(R.id.editTemperature);
|
||||
tvTemperature[0] = (TextView) findViewById(R.id.txtValueTemperature0);
|
||||
tvTemperature[1] = (TextView) findViewById(R.id.txtValueTemperature1);
|
||||
tvTemperature[2] = (TextView) findViewById(R.id.txtValueTemperature2);
|
||||
|
||||
temperatureEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
temperatureSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.temperature_convert, menu);
|
||||
return true;
|
||||
}
|
||||
public void update() {
|
||||
int sigFig = 5; // significant figures displayed
|
||||
if (temperatureEdit.getText().toString().length() > 0) {
|
||||
double value = Double.parseDouble(temperatureEdit.getText().toString());
|
||||
int fromUnits = temperatureSpinner.getSelectedItemPosition();
|
||||
for (int i = 0; i < tvTemperature.length; i++) {
|
||||
tvTemperature[i].setText(String.valueOf(clipNumber(convert(value, fromUnits, i), sigFig)));
|
||||
}
|
||||
}
|
||||
}
|
||||
public double convert (double size, int fromUnits, int toUnits) {
|
||||
// 0=fahrenheit, 1=celsius, 2=kelvin
|
||||
switch (toUnits) {
|
||||
case 0: // toFahrenheit
|
||||
if (fromUnits == 0)
|
||||
return size;
|
||||
else if (fromUnits == 1)
|
||||
return size * 1.8 + 32.0;
|
||||
else
|
||||
return size * 1.8 - 459.67;
|
||||
case 1: // toCelsius
|
||||
if (fromUnits == 0)
|
||||
return (size - 32.0) / 1.8;
|
||||
else if (fromUnits == 1)
|
||||
return size;
|
||||
else
|
||||
return size - 273.15;
|
||||
case 2: // toKelvin
|
||||
if(fromUnits == 0)
|
||||
return (size + 459.67) / 1.8;
|
||||
else if (fromUnits == 1)
|
||||
return size + 273.15;
|
||||
else
|
||||
return size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
public static double clipNumber(double num, int n) {
|
||||
// num is the number; n is number of significant figures returned
|
||||
if(num == 0)
|
||||
return 0;
|
||||
|
||||
final double d = Math.ceil(Math.log10(num < 0 ? -num: num));
|
||||
final int power = n - (int) d;
|
||||
|
||||
final double magnitude = Math.pow(10, power);
|
||||
final long shifted = Math.round(num*magnitude);
|
||||
return shifted/magnitude;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class VolumeConvert extends Activity {
|
||||
Spinner volumeSpinner;
|
||||
EditText volumeEdit;
|
||||
TextView[] tvVolume = new TextView[9];
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.volume);
|
||||
volumeSpinner = (Spinner) findViewById(R.id.spnVolume);
|
||||
volumeEdit = (EditText) findViewById(R.id.editVolume);
|
||||
|
||||
tvVolume[0] = (TextView) findViewById(R.id.txtValueVolume0);
|
||||
tvVolume[1] = (TextView) findViewById(R.id.txtValueVolume1);
|
||||
tvVolume[2] = (TextView) findViewById(R.id.txtValueVolume2);
|
||||
tvVolume[3] = (TextView) findViewById(R.id.txtValueVolume3);
|
||||
tvVolume[4] = (TextView) findViewById(R.id.txtValueVolume4);
|
||||
tvVolume[5] = (TextView) findViewById(R.id.txtValueVolume5);
|
||||
tvVolume[6] = (TextView) findViewById(R.id.txtValueVolume6);
|
||||
tvVolume[7] = (TextView) findViewById(R.id.txtValueVolume7);
|
||||
tvVolume[8] = (TextView) findViewById(R.id.txtValueVolume8);
|
||||
|
||||
volumeEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
volumeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.volume_convert, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
int sigFig = 5; // significant figures displayed
|
||||
if (volumeEdit.getText().toString().length() > 0) {
|
||||
double value = Double.parseDouble(volumeEdit.getText().toString());
|
||||
int fromUnits = volumeSpinner.getSelectedItemPosition();
|
||||
for (int i = 0; i < tvVolume.length; i++) {
|
||||
tvVolume[i].setText(String.valueOf(clipNumber(convert(value, fromUnits, i), sigFig)));
|
||||
}
|
||||
}
|
||||
}
|
||||
public double convert (double size, int fromUnits, int toUnits) {
|
||||
// conv units: 0=ounces, 1=pints, 2=quarts, 3=gallons, 4=cu.ft, 5=milliLtrs, 6=centiLtrs, 7=Liters, 8=cu.meters
|
||||
final double[] conv = {1.0, 16.0, 32.0, 128.0, 957.506494, .033814023, .338140227, 33.8140227, 33814.0227018};
|
||||
return size * conv[fromUnits] / conv[toUnits];
|
||||
}
|
||||
public static double clipNumber(double num, int n) {
|
||||
// num is the number; n is number of significant figures returned
|
||||
if(num == 0)
|
||||
return 0;
|
||||
|
||||
final double d = Math.ceil(Math.log10(num < 0 ? -num: num));
|
||||
final int power = n - (int) d;
|
||||
|
||||
final double magnitude = Math.pow(10, power);
|
||||
final long shifted = Math.round(num*magnitude);
|
||||
return shifted/magnitude;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package missioncollege.cis063.unitsconverter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class WeightConvert extends Activity {
|
||||
Spinner weightSpinner;
|
||||
EditText weightEdit;
|
||||
TextView[] tvWeight = new TextView[8];
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.weight);
|
||||
weightSpinner = (Spinner) findViewById(R.id.spnWeight);
|
||||
weightEdit = (EditText) findViewById(R.id.editWeight);
|
||||
|
||||
tvWeight[0] = (TextView) findViewById(R.id.txtValueWeight0);
|
||||
tvWeight[1] = (TextView) findViewById(R.id.txtValueWeight1);
|
||||
tvWeight[2] = (TextView) findViewById(R.id.txtValueWeight2);
|
||||
tvWeight[3] = (TextView) findViewById(R.id.txtValueWeight3);
|
||||
tvWeight[4] = (TextView) findViewById(R.id.txtValueWeight4);
|
||||
tvWeight[5] = (TextView) findViewById(R.id.txtValueWeight5);
|
||||
tvWeight[6] = (TextView) findViewById(R.id.txtValueWeight6);
|
||||
tvWeight[7] = (TextView) findViewById(R.id.txtValueWeight7);
|
||||
|
||||
weightEdit.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
weightSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parentView) {}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.weight_convert, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
int sigFig = 5; // significant figures displayed
|
||||
if (weightEdit.getText().toString().length() > 0) {
|
||||
double value = Double.parseDouble(weightEdit.getText().toString());
|
||||
int fromUnits = weightSpinner.getSelectedItemPosition();
|
||||
for (int i = 0; i < tvWeight.length; i++) {
|
||||
tvWeight[i].setText(String.valueOf(clipNumber(convert(value, fromUnits, i), sigFig)));
|
||||
}
|
||||
}
|
||||
}
|
||||
public double convert (double size, int fromUnits, int toUnits) {
|
||||
// conv index: 0=ounces, 1=pounds, 2=tons, 3=grams, 4=kg, 5=metric tons, 6=grains, 7=drams
|
||||
final double[] conv = {1.0, 16.0, 32000.0, .03527396195, 35.274, 35274.0, .00228571, .0625};
|
||||
return size * conv[fromUnits] / conv[toUnits];
|
||||
}
|
||||
public static double clipNumber(double num, int n) {
|
||||
// num is the number; n is number of significant figures returned
|
||||
if(num == 0)
|
||||
return 0;
|
||||
|
||||
final double d = Math.ceil(Math.log10(num < 0 ? -num: num));
|
||||
final int power = n - (int) d;
|
||||
|
||||
final double magnitude = Math.pow(10, power);
|
||||
final long shifted = Math.round(num*magnitude);
|
||||
return shifted/magnitude;
|
||||
}
|
||||
}
|
||||
17
src/main/res/drawable-hdpi/blue1_button.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_pressed="true" >
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="3dip" />
|
||||
<stroke android:width="1dip" android:color="#556677" />
|
||||
<gradient android:angle="-90" android:startColor="#aaccee" android:endColor="#88aacc" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="3dip" />
|
||||
<stroke android:width="1dip" android:color="#6677aa" />
|
||||
<gradient android:angle="-90" android:startColor="#bbddff" android:endColor="#aaccee" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
17
src/main/res/drawable-hdpi/blue2_button.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_pressed="true" >
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="3dip" />
|
||||
<stroke android:width="1dip" android:color="#445566" />
|
||||
<gradient android:angle="-90" android:startColor="#7799bb" android:endColor="#6688aa" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="3dip" />
|
||||
<stroke android:width="1dip" android:color="#556677" />
|
||||
<gradient android:angle="-90" android:startColor="#88aacc" android:endColor="#7799bb" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
17
src/main/res/drawable-hdpi/gray1_button.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_pressed="true" >
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="3dip" />
|
||||
<stroke android:width="2dip" android:color="#666" />
|
||||
<gradient android:angle="-90" android:startColor="#ccc" android:endColor="#bbb" />
|
||||
</shape>
|
||||
</item>
|
||||
<item >
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="3dip" />
|
||||
<stroke android:width="1dip" android:color="#888" />
|
||||
<gradient android:angle="-90" android:startColor="#ddd" android:endColor="#ccc" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
17
src/main/res/drawable-hdpi/gray2_button.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_pressed="true" >
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="3dip" />
|
||||
<stroke android:width="2dip" android:color="#555" />
|
||||
<gradient android:angle="-90" android:startColor="#999" android:endColor="#888" />
|
||||
</shape>
|
||||
</item>
|
||||
<item >
|
||||
<shape android:shape="rectangle" >
|
||||
<corners android:radius="3dip" />
|
||||
<stroke android:width="1dip" android:color="#777" />
|
||||
<gradient android:angle="-90" android:startColor="#aaa" android:endColor="#999" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
BIN
src/main/res/drawable-hdpi/ic_icon_angle.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
src/main/res/drawable-hdpi/ic_icon_area.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src/main/res/drawable-hdpi/ic_icon_gas.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
src/main/res/drawable-hdpi/ic_icon_length.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/main/res/drawable-hdpi/ic_icon_numbers.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src/main/res/drawable-hdpi/ic_icon_speed.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
src/main/res/drawable-hdpi/ic_icon_temperature.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/main/res/drawable-hdpi/ic_icon_volume.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
src/main/res/drawable-hdpi/ic_icon_weight.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
src/main/res/drawable-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src/main/res/drawable-hdpi/spacer3.png
Normal file
|
After Width: | Height: | Size: 155 B |
BIN
src/main/res/drawable-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src/main/res/drawable-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
src/main/res/drawable-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
87
src/main/res/layout/angles.xml
Normal file
@@ -0,0 +1,87 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".AnglesConvert" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Angles"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editAngles"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView1"
|
||||
android:ems="10"
|
||||
android:textSize="24sp"
|
||||
android:inputType="numberDecimal" >
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnAngles"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/editAngles"
|
||||
android:entries="@array/anglesUnits" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerAngles"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnAngles"
|
||||
android:src="@drawable/spacer3" />
|
||||
<ImageView
|
||||
android:id="@+id/imgIconAngles"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/imgSpacerAngles"
|
||||
android:src="@drawable/ic_icon_angle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueAngles0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerAngles"
|
||||
android:layout_alignTop="@+id/imgSpacerAngles"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAngles0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerAngles"
|
||||
android:layout_alignTop="@+id/imgSpacerAngles"
|
||||
android:text="Degrees" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueAngles1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerAngles"
|
||||
android:layout_below="@+id/txtValueAngles0"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAngles1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerAngles"
|
||||
android:layout_below="@+id/txtUnitsAngles0"
|
||||
android:text="Radians" />
|
||||
|
||||
</RelativeLayout>
|
||||
186
src/main/res/layout/area.xml
Normal file
@@ -0,0 +1,186 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".AreaConvert" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Area"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editArea"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView1"
|
||||
android:textSize="24sp"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal" >
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnArea"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/editArea"
|
||||
android:entries="@array/areaUnits" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerArea"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnArea"
|
||||
android:src="@drawable/spacer3" />
|
||||
<ImageView
|
||||
android:id="@+id/imgIconArea"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/imgSpacerArea"
|
||||
android:src="@drawable/ic_icon_area" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueAre0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerArea"
|
||||
android:layout_alignTop="@+id/imgSpacerArea"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAre0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerArea"
|
||||
android:layout_alignTop="@+id/imgSpacerArea"
|
||||
android:text="Sq.Inches" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueAre1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtValueAre0"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAre1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtUnitsAre0"
|
||||
android:text="Sq.Feet" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueAre2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtValueAre1"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAre2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtUnitsAre1"
|
||||
android:text="Sq.Miles" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueAre3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtValueAre2"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAre3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtUnitsAre2"
|
||||
android:text="Sq.Millimeters" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueAre4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtValueAre3"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAre4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtUnitsAre3"
|
||||
android:text="Sq.Meters" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueAre5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtValueAre4"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAre5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtUnitsAre4"
|
||||
android:text="Sq.Kilometers" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueAre6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtValueAre5"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAre6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtUnitsAre5"
|
||||
android:text="Acres" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueAre7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtValueAre6"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAre7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtUnitsAre6"
|
||||
android:text="Hectares" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueAre8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtValueAre7"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsAre8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerArea"
|
||||
android:layout_below="@+id/txtUnitsAre7"
|
||||
android:text="Ping" />
|
||||
|
||||
</RelativeLayout>
|
||||
475
src/main/res/layout/calculator.xml
Normal file
@@ -0,0 +1,475 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".Calculator" >
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtCalcBreadcrumbs"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="left|center_vertical"
|
||||
android:paddingRight="5dp"
|
||||
android:background="#eee"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#333333"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtCalculator"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/txtCalcBreadcrumbs"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="#ddd"
|
||||
android:gravity="right|center_vertical"
|
||||
android:paddingRight="5dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#000000"
|
||||
android:textSize="30sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnMR"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/txtCalculator"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="MR"
|
||||
android:background="@drawable/blue2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickMR" />
|
||||
<Button
|
||||
android:id="@+id/btnMminus"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnMR"
|
||||
android:layout_toLeftOf="@+id/btnMR"
|
||||
android:text="M-"
|
||||
android:background="@drawable/blue2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickMminus" />
|
||||
<Button
|
||||
android:id="@+id/btnMplus"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnMR"
|
||||
android:layout_toLeftOf="@+id/btnMminus"
|
||||
android:text="M+"
|
||||
android:background="@drawable/blue2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickMplus" />
|
||||
<Button
|
||||
android:id="@+id/btnMC"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnMR"
|
||||
android:layout_toRightOf="@+id/btnMR"
|
||||
android:text="MC"
|
||||
android:background="@drawable/blue2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickMC" />
|
||||
<Button
|
||||
android:id="@+id/btnClear"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnMR"
|
||||
android:layout_toRightOf="@+id/btnMC"
|
||||
android:text="C"
|
||||
android:background="@drawable/blue1_button"
|
||||
android:textSize="30sp"
|
||||
android:onClick="clickClear" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTan"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/btnMR"
|
||||
android:text="tan"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickTan" />
|
||||
<Button
|
||||
android:id="@+id/btnCos"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnTan"
|
||||
android:layout_toLeftOf="@+id/btnTan"
|
||||
android:text="cos"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickCos" />
|
||||
<Button
|
||||
android:id="@+id/btnSin"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnTan"
|
||||
android:layout_toLeftOf="@+id/btnCos"
|
||||
android:text="sin"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickSin" />
|
||||
<Button
|
||||
android:id="@+id/btnRoot"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnTan"
|
||||
android:layout_toRightOf="@+id/btnTan"
|
||||
android:text="\u221A"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickRoot" />
|
||||
<Button
|
||||
android:id="@+id/btnDel"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnTan"
|
||||
android:layout_toRightOf="@+id/btnRoot"
|
||||
android:text="del"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickDel" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnLog10"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/btnTan"
|
||||
android:text="log"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickLog10" />
|
||||
<Button
|
||||
android:id="@+id/btnLn"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnLog10"
|
||||
android:layout_toLeftOf="@+id/btnLog10"
|
||||
android:text="ln"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickLn" />
|
||||
<Button
|
||||
android:id="@+id/btnAbs"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnLog10"
|
||||
android:layout_toLeftOf="@+id/btnLn"
|
||||
android:text="|x|"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickAbs" />
|
||||
<Button
|
||||
android:id="@+id/btnE"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnLog10"
|
||||
android:layout_toRightOf="@+id/btnLog10"
|
||||
android:text="e"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickE" />
|
||||
<Button
|
||||
android:id="@+id/btnTbd"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnLog10"
|
||||
android:layout_toRightOf="@+id/btnE"
|
||||
android:text=""
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickTbd" />
|
||||
<Button
|
||||
android:id="@+id/btnPrm"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/btnLog10"
|
||||
android:text="prm"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickPrime" />
|
||||
<Button
|
||||
android:id="@+id/btnLcm"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnPrm"
|
||||
android:layout_toLeftOf="@+id/btnPrm"
|
||||
android:text="lcm"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickLcm" />
|
||||
<Button
|
||||
android:id="@+id/btnGcf"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnPrm"
|
||||
android:layout_toLeftOf="@+id/btnLcm"
|
||||
android:text="gcf"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickGcf" />
|
||||
<Button
|
||||
android:id="@+id/btnPi"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnPrm"
|
||||
android:layout_toRightOf="@+id/btnPrm"
|
||||
android:text="\u03C0"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickPi" />
|
||||
<Button
|
||||
android:id="@+id/btnExp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnPrm"
|
||||
android:layout_toRightOf="@+id/btnPi"
|
||||
android:text="X^Y"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickPower" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn9"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/btnPrm"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="9"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click9" />
|
||||
<Button
|
||||
android:id="@+id/btn8"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn9"
|
||||
android:layout_toLeftOf="@+id/btn9"
|
||||
android:text="8"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click8" />
|
||||
<Button
|
||||
android:id="@+id/btn7"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn9"
|
||||
android:layout_toLeftOf="@+id/btn8"
|
||||
android:text="7"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click7" />
|
||||
<Button
|
||||
android:id="@+id/btnDivide"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn9"
|
||||
android:layout_toRightOf="@+id/btn9"
|
||||
android:text="\u00F7"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/blue2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickDivide" />
|
||||
<Button
|
||||
android:id="@+id/btn6"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/btn9"
|
||||
android:text="6"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click6" />
|
||||
<Button
|
||||
android:id="@+id/btn5"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn6"
|
||||
android:layout_toLeftOf="@+id/btn6"
|
||||
android:text="5"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click5" />
|
||||
<Button
|
||||
android:id="@+id/btn4"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn6"
|
||||
android:layout_toLeftOf="@+id/btn5"
|
||||
android:text="4"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click4" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn3"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/btn6"
|
||||
android:text="3"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click3" />
|
||||
<Button
|
||||
android:id="@+id/btn2"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn3"
|
||||
android:layout_toLeftOf="@+id/btn3"
|
||||
android:text="2"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click2" />
|
||||
<Button
|
||||
android:id="@+id/btn1"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn3"
|
||||
android:layout_toLeftOf="@+id/btn2"
|
||||
android:text="1"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click1" />
|
||||
<Button
|
||||
android:id="@+id/btn0"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnDot"
|
||||
android:layout_alignRight="@+id/btn1"
|
||||
android:text="0"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="click0" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnMultiply"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn6"
|
||||
android:layout_toRightOf="@+id/btn6"
|
||||
android:text="X"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/blue2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickMultiply" />
|
||||
<Button
|
||||
android:id="@+id/btnInverse"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn6"
|
||||
android:layout_toRightOf="@+id/btnMultiply"
|
||||
android:text="1/x"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickInverse" />
|
||||
<Button
|
||||
android:id="@+id/btnSubtract"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn3"
|
||||
android:layout_toRightOf="@+id/btn3"
|
||||
android:text="\u2014"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/blue2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickSubtract" />
|
||||
<Button
|
||||
android:id="@+id/btnPercent"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btn3"
|
||||
android:layout_toRightOf="@+id/btnSubtract"
|
||||
android:text="%"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickPercent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAdd"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnPosNeg"
|
||||
android:layout_toRightOf="@+id/btnPosNeg"
|
||||
android:background="@drawable/blue2_button"
|
||||
android:onClick="clickAdd"
|
||||
android:text="+"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="25sp" />
|
||||
<Button
|
||||
android:id="@+id/btnSquare"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnDivide"
|
||||
android:layout_toRightOf="@+id/btnDivide"
|
||||
android:text="X^2"
|
||||
android:textColor="#ffffff"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:textSize="25sp"
|
||||
android:onClick="clickSquare" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPosNeg"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/btn3"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/gray2_button"
|
||||
android:onClick="clickPosNeg"
|
||||
android:text="+/\u2014"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="20dp" />
|
||||
<Button
|
||||
android:id="@+id/btnEquals"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnAdd"
|
||||
android:layout_toRightOf="@+id/btnAdd"
|
||||
android:text="="
|
||||
android:background="@drawable/blue1_button"
|
||||
android:textSize="30sp"
|
||||
android:onClick="clickEquals" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDot"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/btnPosNeg"
|
||||
android:layout_toLeftOf="@+id/btnPosNeg"
|
||||
android:background="@drawable/gray1_button"
|
||||
android:onClick="clickDot"
|
||||
android:text="."
|
||||
android:textSize="35sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
172
src/main/res/layout/currency.xml
Normal file
@@ -0,0 +1,172 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".CurrencyConvert" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Currency"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editCurrency"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView10"
|
||||
android:ems="10"
|
||||
android:textSize="24sp"
|
||||
android:inputType="numberDecimal" >
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnCurrency"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/editCurrency"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:entries="@array/currencyUnits" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerTemperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnCurrency"
|
||||
android:src="@drawable/spacer3" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueCurrency0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_alignTop="@+id/imgSpacerTemperature"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsCurrency0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_alignTop="@+id/imgSpacerTemperature"
|
||||
android:text="US Dollars" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueCurrency1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtValueCurrency0"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsCurrency1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtUnitsCurrency0"
|
||||
android:text="Euros" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueCurrency2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtValueCurrency1"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsCurrency2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtUnitsCurrency1"
|
||||
android:text="British Pounds" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueCurrency3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtValueCurrency2"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsCurrency3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtUnitsCurrency2"
|
||||
android:text="Japanese Yen" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueCurrency4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtValueCurrency3"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsCurrency4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtUnitsCurrency3"
|
||||
android:text="Canadian Dollars" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueCurrency5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtValueCurrency4"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsCurrency5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtUnitsCurrency4"
|
||||
android:text="Chinese Yuan" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueCurrency6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtValueCurrency5"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsCurrency6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtUnitsCurrency5"
|
||||
android:text="Australian Dollars" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueCurrency7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtValueCurrency6"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsCurrency7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtUnitsCurrency6"
|
||||
android:text="Mexican Pesos" />
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/imgSpacerTemperature"
|
||||
android:layout_centerHorizontal="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
86
src/main/res/layout/gas_mileage.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".GasMileage" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="GasMileage"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editGasMileage"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView3"
|
||||
android:ems="10"
|
||||
android:textSize="24sp"
|
||||
android:inputType="numberDecimal" >
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnGasMileage"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/editGasMileage"
|
||||
android:entries="@array/gasUnits" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerGasMileage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnGasMileage"
|
||||
android:src="@drawable/spacer3" />
|
||||
<ImageView
|
||||
android:id="@+id/imgIconGasMileage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/imgSpacerGasMileage"
|
||||
android:src="@drawable/ic_icon_gas" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueGasMileage0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerGasMileage"
|
||||
android:layout_alignTop="@+id/imgSpacerGasMileage"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsGasMileage0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerGasMileage"
|
||||
android:layout_alignTop="@+id/imgSpacerGasMileage"
|
||||
android:text="Miles per Gallon" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueGasMileage1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerGasMileage"
|
||||
android:layout_below="@+id/txtValueGasMileage0"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsGasMileage1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerGasMileage"
|
||||
android:layout_below="@+id/txtUnitsGasMileage0"
|
||||
android:text="Kilometers per Liter" />
|
||||
|
||||
</RelativeLayout>
|
||||
186
src/main/res/layout/length.xml
Normal file
@@ -0,0 +1,186 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".LengthConvert" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Length"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editLength"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView4"
|
||||
android:ems="12"
|
||||
android:textSize="24sp"
|
||||
android:inputType="numberDecimal" >
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnLength"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/editLength"
|
||||
android:entries="@array/lengthUnits" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerLength"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnLength"
|
||||
android:src="@drawable/spacer3" />
|
||||
<ImageView
|
||||
android:id="@+id/imgIconLength"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/imgSpacerLength"
|
||||
android:src="@drawable/ic_icon_length" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueLength0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerLength"
|
||||
android:layout_alignTop="@+id/imgSpacerLength"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsLength0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerLength"
|
||||
android:layout_alignTop="@+id/imgSpacerLength"
|
||||
android:text="Inches" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueLength1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtValueLength0"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsLength1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtUnitsLength0"
|
||||
android:text="Feet" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueLength2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtValueLength1"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsLength2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtUnitsLength1"
|
||||
android:text="Yards" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueLength3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtValueLength2"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsLength3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtUnitsLength2"
|
||||
android:text="Miles" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueLength4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtValueLength3"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsLength4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtUnitsLength3"
|
||||
android:text="Millimeters" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueLength5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtValueLength4"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsLength5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtUnitsLength4"
|
||||
android:text="Centimeters" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueLength6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtValueLength5"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsLength6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtUnitsLength5"
|
||||
android:text="Meters" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueLength7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtValueLength6"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsLength7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtUnitsLength6"
|
||||
android:text="Kilometers" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueLength8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtValueLength7"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsLength8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerLength"
|
||||
android:layout_below="@+id/txtUnitsLength7"
|
||||
android:text="Nautical Miles" />
|
||||
|
||||
</RelativeLayout>
|
||||
19
src/main/res/layout/main.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".Main" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/categories"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@+id/categories"
|
||||
android:textSize="25dp" >
|
||||
</TextView>
|
||||
|
||||
</RelativeLayout>
|
||||
137
src/main/res/layout/numbers.xml
Normal file
@@ -0,0 +1,137 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".NumbersConvert" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Number Systems"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtNumber"
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView5"
|
||||
android:ems="10"
|
||||
android:inputType="text" >
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnNumbers"
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/txtNumber"
|
||||
android:entries="@array/NumberFormats"
|
||||
android:prompt="@string/prompt_txtNumberFormat" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtVDec"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerNumbers"
|
||||
android:layout_below="@+id/spnNumbers"
|
||||
android:text="@string/title_decimal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtVBi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerNumbers"
|
||||
android:layout_below="@+id/txtVDec"
|
||||
android:text="@string/title_binary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtVOct"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerNumbers"
|
||||
android:layout_below="@+id/txtVBi"
|
||||
android:text="@string/title_octal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtVHex"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerNumbers"
|
||||
android:layout_below="@+id/txtVOct"
|
||||
android:text="Hexadecimal(16)" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtVRoman"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerNumbers"
|
||||
android:layout_below="@+id/txtVHex"
|
||||
android:text="@string/title_roman" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtHex"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/txtOct"
|
||||
android:layout_toLeftOf="@+id/imgSpacerNumbers"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtOct"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/txtBi"
|
||||
android:layout_toLeftOf="@+id/imgSpacerNumbers"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtBi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/txtDec"
|
||||
android:layout_toLeftOf="@+id/imgSpacerNumbers"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtDec"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/spnNumbers"
|
||||
android:layout_toLeftOf="@+id/imgSpacerNumbers"
|
||||
android:text="0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerNumbers"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnNumbers"
|
||||
android:src="@drawable/spacer3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtRoman"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/txtHex"
|
||||
android:layout_toLeftOf="@+id/imgSpacerNumbers"
|
||||
android:text="0" />
|
||||
<ImageView
|
||||
android:id="@+id/imgIconNumbers"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/imgSpacerNumbers"
|
||||
android:src="@drawable/ic_icon_numbers" />
|
||||
|
||||
</RelativeLayout>
|
||||
171
src/main/res/layout/speed.xml
Normal file
@@ -0,0 +1,171 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".SpeedConvert" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Speed"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editSpeed"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView6"
|
||||
android:ems="10"
|
||||
android:textSize="24sp"
|
||||
android:inputType="numberDecimal" >
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnSpeed"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/editSpeed"
|
||||
android:entries="@array/speedUnits" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerSpeed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnSpeed"
|
||||
android:src="@drawable/spacer3" />
|
||||
<ImageView
|
||||
android:id="@+id/imgIconSpeed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/imgSpacerSpeed"
|
||||
android:src="@drawable/ic_icon_speed" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueSpeed0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerSpeed"
|
||||
android:layout_alignTop="@+id/imgSpacerSpeed"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsSpeed0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerSpeed"
|
||||
android:layout_alignTop="@+id/imgSpacerSpeed"
|
||||
android:text="Inches per Sec" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueSpeed1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtValueSpeed0"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsSpeed1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtUnitsSpeed0"
|
||||
android:text="Feet per Sec" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueSpeed2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtValueSpeed1"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsSpeed2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtUnitsSpeed1"
|
||||
android:text="Miles per Hour" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueSpeed3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtValueSpeed2"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsSpeed3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtUnitsSpeed2"
|
||||
android:text="Centimeters per Sec" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueSpeed4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtValueSpeed3"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsSpeed4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtUnitsSpeed3"
|
||||
android:text="Meters per Sec" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueSpeed5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtValueSpeed4"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsSpeed5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtUnitsSpeed4"
|
||||
android:text="Kilometers per Hour" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueSpeed6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtValueSpeed5"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsSpeed6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtUnitsSpeed5"
|
||||
android:text="Knots" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueSpeed7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtValueSpeed6"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsSpeed7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerSpeed"
|
||||
android:layout_below="@+id/txtUnitsSpeed6"
|
||||
android:text="Mach" />
|
||||
|
||||
</RelativeLayout>
|
||||
101
src/main/res/layout/temperature.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".TemperatureConvert" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Temperature"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTemperature"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView7"
|
||||
android:ems="10"
|
||||
android:textSize="24sp"
|
||||
android:inputType="numberDecimal" >
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnTemperature"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/editTemperature"
|
||||
android:entries="@array/tempUnits" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerTemperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnTemperature"
|
||||
android:src="@drawable/spacer3" />
|
||||
<ImageView
|
||||
android:id="@+id/imgIconTemperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/imgSpacerTemperature"
|
||||
android:src="@drawable/ic_icon_temperature" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueTemperature0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_alignTop="@+id/imgSpacerTemperature"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsTemperature0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_alignTop="@+id/imgSpacerTemperature"
|
||||
android:text="Fahrenheit" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueTemperature1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtValueTemperature0"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsTemperature1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtUnitsTemperature0"
|
||||
android:text="Celsius" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueTemperature2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtValueTemperature1"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsTemperature2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerTemperature"
|
||||
android:layout_below="@+id/txtUnitsTemperature1"
|
||||
android:text="Kelvin" />
|
||||
|
||||
</RelativeLayout>
|
||||
185
src/main/res/layout/volume.xml
Normal file
@@ -0,0 +1,185 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".VolumeConvert" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Volume"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editVolume"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView8"
|
||||
android:ems="10"
|
||||
android:textSize="24sp"
|
||||
android:inputType="numberDecimal" >
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnVolume"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/editVolume"
|
||||
android:entries="@array/volumeUnits" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerVolume"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnVolume"
|
||||
android:src="@drawable/spacer3" />
|
||||
<ImageView
|
||||
android:id="@+id/imgIconVolume"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/imgSpacerVolume"
|
||||
android:src="@drawable/ic_icon_volume" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueVolume0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerVolume"
|
||||
android:layout_alignTop="@+id/imgSpacerVolume"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsVolume0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerVolume"
|
||||
android:layout_alignTop="@+id/imgSpacerVolume"
|
||||
android:text="Ounces" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueVolume1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtValueVolume0"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsVolume1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtUnitsVolume0"
|
||||
android:text="Pints" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueVolume2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtValueVolume1"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsVolume2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtUnitsVolume1"
|
||||
android:text="Quarts" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueVolume3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtValueVolume2"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsVolume3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtUnitsVolume2"
|
||||
android:text="Gallons" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueVolume4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtValueVolume3"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsVolume4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtUnitsVolume3"
|
||||
android:text="Cubic Feet" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueVolume5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtValueVolume4"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsVolume5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtUnitsVolume4"
|
||||
android:text="Milliliters" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueVolume6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtValueVolume5"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsVolume6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtUnitsVolume5"
|
||||
android:text="Centiliters (cc)" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueVolume7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtValueVolume6"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsVolume7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtUnitsVolume6"
|
||||
android:text="Liters" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueVolume8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtValueVolume7"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsVolume8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerVolume"
|
||||
android:layout_below="@+id/txtUnitsVolume7"
|
||||
android:text="Cubic Meters" />
|
||||
</RelativeLayout>
|
||||
174
src/main/res/layout/weight.xml
Normal file
@@ -0,0 +1,174 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".WeightConvert" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="Weight"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#0072bc"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editWeight"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/textView9"
|
||||
android:textSize="24sp"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal" >
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnWeight"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/editWeight"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/editWeight"
|
||||
android:entries="@array/weightUnits" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgSpacerWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/spnWeight"
|
||||
android:src="@drawable/spacer3" />
|
||||
<ImageView
|
||||
android:id="@+id/imgIconWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/imgSpacerWeight"
|
||||
android:src="@drawable/ic_icon_weight" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueWeight0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerWeight"
|
||||
android:layout_alignTop="@+id/imgSpacerWeight"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsWeight0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerWeight"
|
||||
android:layout_alignTop="@+id/imgSpacerWeight"
|
||||
android:text="Ounces" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueWeight1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtValueWeight0"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsWeight1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtUnitsWeight0"
|
||||
android:text="Pounds" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueWeight2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtValueWeight1"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsWeight2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtUnitsWeight1"
|
||||
android:text="Tons" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtValueWeight3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtValueWeight2"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsWeight3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtUnitsWeight2"
|
||||
android:text="Grams" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueWeight4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtValueWeight3"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsWeight4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtUnitsWeight3"
|
||||
android:text="Kilograms" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueWeight5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtValueWeight4"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsWeight5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtUnitsWeight4"
|
||||
android:text="Metric Tons" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueWeight6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtValueWeight5"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsWeight6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtUnitsWeight5"
|
||||
android:text="Grains" />
|
||||
<TextView
|
||||
android:id="@+id/txtValueWeight7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtValueWeight6"
|
||||
android:text="0" />
|
||||
<TextView
|
||||
android:id="@+id/txtUnitsWeight7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/imgSpacerWeight"
|
||||
android:layout_below="@+id/txtUnitsWeight6"
|
||||
android:text="Drams" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
9
src/main/res/menu/angles_convert.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/area_convert.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/calculator.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/currency_convert.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/gas_mileage.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/length_convert.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/main.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/numbers_convert.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/speed_convert.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/temperature_convert.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/volume_convert.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
9
src/main/res/menu/weight_convert.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
||||
8
src/main/res/values-sw600dp/dimens.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw600dp devices (e.g. 7" tablets) here.
|
||||
-->
|
||||
|
||||
</resources>
|
||||
9
src/main/res/values-sw720dp-land/dimens.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
|
||||
-->
|
||||
<dimen name="activity_horizontal_margin">128dp</dimen>
|
||||
|
||||
</resources>
|
||||
11
src/main/res/values-v11/styles.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme for API 11+. This theme completely replaces
|
||||
AppBaseTheme from res/values/styles.xml on API 11+ devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
|
||||
<!-- API 11 theme customizations can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
12
src/main/res/values-v14/styles.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme for API 14+. This theme completely replaces
|
||||
AppBaseTheme from BOTH res/values/styles.xml and
|
||||
res/values-v11/styles.xml on API 14+ devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
|
||||
<!-- API 14 theme customizations can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
7
src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
</resources>
|
||||
111
src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">Units Converter</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="title_activity_convert">Units Converter</string>
|
||||
<string name="title_activity_length_convert">Convert Length</string>
|
||||
<string name="title_activity_area_convert">Area</string>
|
||||
<string name="prompt_txtNumberFormat">Number Format</string>
|
||||
|
||||
<string-array name="areaUnits">
|
||||
<item>Square Inches</item>
|
||||
<item>Square Feet</item>
|
||||
<item>Square Miles</item>
|
||||
<item>Square Millimeters</item>
|
||||
<item>Square Meters</item>
|
||||
<item>Square Kilometers</item>
|
||||
<item>Acres</item>
|
||||
<item>Hectares</item>
|
||||
<item>Ping</item>
|
||||
</string-array>
|
||||
<string-array name="lengthUnits">
|
||||
<item>Inches</item>
|
||||
<item>Feet</item>
|
||||
<item>Yards</item>
|
||||
<item>Miles</item>
|
||||
<item>Millimeters</item>
|
||||
<item>Centimeters</item>
|
||||
<item>Meters</item>
|
||||
<item>Kilometers</item>
|
||||
<item>Nautical Miles</item>
|
||||
</string-array>
|
||||
<string-array name="anglesUnits">
|
||||
<item>Degrees</item>
|
||||
<item>Radians</item>
|
||||
</string-array>
|
||||
<string-array name="gasUnits">
|
||||
<item>Miles per Gallon</item>
|
||||
<item>Kilometers per Liter</item>
|
||||
</string-array>
|
||||
<string-array name="speedUnits">
|
||||
<item>Inches per Second</item>
|
||||
<item>Feet per Second</item>
|
||||
<item>Miles per Hour</item>
|
||||
<item>Centimeters per Second</item>
|
||||
<item>Meters per Second</item>
|
||||
<item>Kilometers per Hour</item>
|
||||
<item>Knots</item>
|
||||
<item>Mach</item>
|
||||
</string-array>
|
||||
<string-array name="weightUnits">
|
||||
<item>Ounces</item>
|
||||
<item>Pounds</item>
|
||||
<item>Tons</item>
|
||||
<item>Grams</item>
|
||||
<item>Kilograms</item>
|
||||
<item>Metric Tons</item>
|
||||
<item>Grains</item>
|
||||
<item>Drams</item>
|
||||
</string-array>
|
||||
<string-array name="NumberFormats">
|
||||
<item>Decimal (Base 10)</item>
|
||||
<item>Binary (Base 2)</item>
|
||||
<item>Octal (Base 8)</item>
|
||||
<item>Hexadecimal (Base 16)</item>
|
||||
<item>Roman Numeral (Max 3999)</item>
|
||||
</string-array>
|
||||
<string-array name="tempUnits">
|
||||
<item>Fahrenheit</item>
|
||||
<item>Celsius</item>
|
||||
<item>Kelvin</item>
|
||||
</string-array>
|
||||
<string-array name="volumeUnits">
|
||||
<item>Ounces</item>
|
||||
<item>Pints</item>
|
||||
<item>Quarts</item>
|
||||
<item>Gallons</item>
|
||||
<item>Cubic Feet</item>
|
||||
<item>Milliliters</item>
|
||||
<item>Centiliters (cc)</item>
|
||||
<item>Liters</item>
|
||||
<item>Cubic Meters</item>
|
||||
</string-array>
|
||||
<string-array name="currencyUnits">
|
||||
<item>US Dollars</item>
|
||||
<item>Euros</item>
|
||||
<item>British Pounds</item>
|
||||
<item>Japanese Yen</item>
|
||||
<item>Canadian Dollars</item>
|
||||
<item>Chinese Yuan</item>
|
||||
<item>Australian Dollars</item>
|
||||
<item>Mexican Pesos</item>
|
||||
</string-array>
|
||||
|
||||
<string name="title_activity_angles_convert">Angles</string>
|
||||
<string name="title_activity_gas_mileage_convert">Gas Mileage</string>
|
||||
<string name="title_activity_speed_convert">Speed</string>
|
||||
<string name="title_activity_weight_convert">Weight</string>
|
||||
<string name="title_activity_numbers_convert">Numbers</string>
|
||||
<string name="title_activity_temperature_convert">Temperature</string>
|
||||
<string name="title_activity_currency_convert">Currency</string>
|
||||
<string name="title_activity_volume_convert">Volume</string>
|
||||
<string name="title_activity_gas_mileage">Gas Mileage</string>
|
||||
<string name="title_decimal">Decimal (Base 10)</string>
|
||||
<string name="title_binary">Binary (Base 2)</string>
|
||||
<string name="title_octal">Octal (Base 8)</string>
|
||||
<string name="title_hex">Hexadecimal (Base 16)</string>
|
||||
<string name="title_roman">Roman Numeral</string>
|
||||
<string name="title_activity_calculator">Calculator</string>
|
||||
|
||||
</resources>
|
||||
20
src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme, dependent on API level. This theme is replaced
|
||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="android:Theme.Light">
|
||||
<!--
|
||||
Theme customizations available in newer API levels can go in
|
||||
res/values-vXX/styles.xml, while customizations related to
|
||||
backward-compatibility can go here.
|
||||
-->
|
||||
</style>
|
||||
|
||||
<!-- Application theme. -->
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||