-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Roeun
committed
Oct 9, 2012
1 parent
acd8864
commit 4e4dcf9
Showing
19 changed files
with
294 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.calculatevariable" | ||
android:versionCode="1" | ||
android:versionName="1.0" > | ||
|
||
<uses-sdk | ||
android:minSdkVersion="8" | ||
android:targetSdkVersion="15" /> | ||
|
||
<application | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
<activity | ||
android:name=".CalculateVariable" | ||
android:label="@string/title_activity_calculate_variable" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# To enable ProGuard in your project, edit project.properties | ||
# to define the proguard.config property as described in that file. | ||
# | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in ${sdk.dir}/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the ProGuard | ||
# include property in project.properties. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system edit | ||
# "ant.properties", and override values to adapt the script to your | ||
# project structure. | ||
# | ||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): | ||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt | ||
|
||
# Project target. | ||
target=android-16 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<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" > | ||
|
||
<TextView | ||
android:id="@+id/lblTitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentTop="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginTop="22dp" | ||
android:text="@string/lblTitle" | ||
android:textAppearance="?android:attr/textAppearanceLarge" /> | ||
|
||
<EditText | ||
android:id="@+id/editText3" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentRight="true" | ||
android:layout_below="@+id/lblTitle" | ||
android:layout_marginRight="17dp" | ||
android:layout_marginTop="33dp" | ||
android:ems="10" | ||
android:inputType="numberDecimal" /> | ||
|
||
<TextView | ||
android:id="@+id/lblValue1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignBottom="@+id/editText3" | ||
android:layout_toLeftOf="@+id/editText3" | ||
android:text="@string/lblValue1" | ||
android:textAppearance="?android:attr/textAppearanceMedium" /> | ||
|
||
<EditText | ||
android:id="@+id/txtValue2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@+id/editText3" | ||
android:layout_marginTop="16dp" | ||
android:layout_toRightOf="@+id/lblValue1" | ||
android:ems="10" | ||
android:inputType="numberDecimal" /> | ||
|
||
<TextView | ||
android:id="@+id/lblValue2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignBottom="@+id/txtValue2" | ||
android:layout_toLeftOf="@+id/txtValue2" | ||
android:text="@string/lblValue2" | ||
android:textAppearance="?android:attr/textAppearanceMedium" /> | ||
|
||
<Button | ||
android:id="@+id/btnMinus" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignLeft="@+id/lblValue2" | ||
android:layout_below="@+id/lblValue2" | ||
android:layout_marginTop="15dp" | ||
android:text="@string/btnMinus" /> | ||
|
||
<Button | ||
android:id="@+id/btnMultiple" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignBaseline="@+id/btnMinus" | ||
android:layout_alignBottom="@+id/btnMinus" | ||
android:layout_toRightOf="@+id/btnMinus" | ||
android:text="@string/btnMultiple" /> | ||
|
||
<Button | ||
android:id="@+id/btnSum" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignBaseline="@+id/btnMultiple" | ||
android:layout_alignBottom="@+id/btnMultiple" | ||
android:layout_toRightOf="@+id/btnMultiple" | ||
android:text="@string/btnSum" /> | ||
|
||
<Button | ||
android:id="@+id/btnDivide" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignBaseline="@+id/btnSum" | ||
android:layout_alignBottom="@+id/btnSum" | ||
android:layout_toRightOf="@+id/btnSum" | ||
android:text="@string/btnDivide" /> | ||
|
||
<TextView | ||
android:id="@+id/lblResult" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignLeft="@+id/btnMinus" | ||
android:layout_below="@+id/btnMinus" | ||
android:layout_marginTop="29dp" | ||
android:text="@string/lblResult" | ||
android:textAppearance="?android:attr/textAppearanceMedium" /> | ||
|
||
<EditText | ||
android:id="@+id/txtResult" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignBaseline="@+id/lblResult" | ||
android:layout_alignBottom="@+id/lblResult" | ||
android:layout_alignLeft="@+id/txtValue2" | ||
android:ems="10" | ||
android:inputType="numberDecimal" /> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:id="@+id/menu_settings" | ||
android:title="@string/menu_settings" | ||
android:orderInCategory="100" | ||
android:showAsAction="never" /> | ||
</menu> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<resources> | ||
|
||
<style name="AppTheme" parent="android:Theme.Holo.Light" /> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<resources> | ||
|
||
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" /> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<resources> | ||
|
||
<string name="app_name">CalculateVariable</string> | ||
<string name="hello_world">Hello world!</string> | ||
<string name="menu_settings">Settings</string> | ||
<string name="title_activity_calculate_variable">Calculate Variable</string> | ||
<string name="lblTitle">My Simple Calculateor</string> | ||
<string name="lblValue1">Value 1:</string> | ||
<string name="lblValue2">Value 2:</string> | ||
<string name="lblResult">Result:</string> | ||
<string name="btnSum">+</string> | ||
<string name="btnMinus">-</string> | ||
<string name="btnMultiple">*</string> | ||
<string name="btnDivide">/</string> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<resources> | ||
|
||
<style name="AppTheme" parent="android:Theme.Light" /> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package com.example.calculatevariable; | ||
|
||
import android.os.Bundle; | ||
import android.app.Activity; | ||
import android.view.Menu; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
|
||
public class CalculateVariable extends Activity { | ||
|
||
Button btnSum; | ||
Button btnMinus; | ||
Button btnMultiple; | ||
Button btnDivide; | ||
EditText txtValue1; | ||
EditText txtValue2; | ||
EditText txtResult; | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_calculate_variable); | ||
|
||
btnSum = (Button) this.findViewById(R.id.btnSum); | ||
btnMinus = (Button) this.findViewById(R.id.btnMinus); | ||
btnMultiple = (Button) this.findViewById(R.id.btnMultiple); | ||
btnDivide = (Button) this.findViewById(R.id.btnDivide); | ||
txtValue1 = (EditText) this.findViewById(R.id.editText3); | ||
txtValue2 = (EditText) this.findViewById(R.id.txtValue2); | ||
txtResult = (EditText) this.findViewById(R.id.txtResult); | ||
|
||
btnSum.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
// TODO Auto-generated method stub | ||
double value1 = Double.parseDouble(txtValue1.getText().toString()); | ||
double value2 = Double.parseDouble(txtValue2.getText().toString()); | ||
double result = value1 + value2; | ||
txtResult.setText(Double.toString(result)); | ||
} | ||
}); | ||
|
||
|
||
btnMinus.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
// TODO Auto-generated method stub | ||
double value1 = Double.parseDouble(txtValue1.getText().toString()); | ||
double value2 = Double.parseDouble(txtValue2.getText().toString()); | ||
double result = value1 - value2; | ||
txtResult.setText(Double.toString(result)); | ||
} | ||
}); | ||
|
||
|
||
btnMultiple.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
// TODO Auto-generated method stub | ||
double value1 = Double.parseDouble(txtValue1.getText().toString()); | ||
double value2 = Double.parseDouble(txtValue2.getText().toString()); | ||
double result = value1 * value2; | ||
txtResult.setText(Double.toString(result)); | ||
} | ||
}); | ||
|
||
|
||
btnDivide.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
// TODO Auto-generated method stub | ||
double value1 = Double.parseDouble(txtValue1.getText().toString()); | ||
double value2 = Double.parseDouble(txtValue2.getText().toString()); | ||
double result = value1 / value2; | ||
txtResult.setText(Double.toString(result)); | ||
} | ||
}); | ||
|
||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
getMenuInflater().inflate(R.menu.activity_calculate_variable, menu); | ||
return true; | ||
} | ||
} |