summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-03-03 14:25:51 -0800
committerAlan Viverette <alanv@google.com>2014-03-03 14:25:51 -0800
commit8bea49415c6de57f7e14517bf64769d24e3f099d (patch)
treebf64648afd1e32a5296de4ead59568c3f53d2061
parentaf332849122b66ebaa567aef9621d7cbe2b7e6de (diff)
downloadandroid_packages_apps_ExactCalculator-8bea49415c6de57f7e14517bf64769d24e3f099d.tar.gz
android_packages_apps_ExactCalculator-8bea49415c6de57f7e14517bf64769d24e3f099d.tar.bz2
android_packages_apps_ExactCalculator-8bea49415c6de57f7e14517bf64769d24e3f099d.zip
Quantum of Calculator
Change-Id: Ic79777951621c42f03e7da9dd73c350f5182f48e
-rw-r--r--AndroidManifest.xml2
-rw-r--r--res/drawable-hdpi/advanced.pngbin3121 -> 0 bytes
-rw-r--r--res/drawable-hdpi/btn_keyboard_key_dark_normal_holo.9.pngbin320 -> 0 bytes
-rw-r--r--res/drawable-hdpi/btn_keyboard_key_dark_pressed_holo.9.pngbin537 -> 0 bytes
-rw-r--r--res/drawable-hdpi/btn_keyboard_key_light_normal_holo.9.pngbin329 -> 0 bytes
-rw-r--r--res/drawable-hdpi/btn_keyboard_key_light_pressed_holo.9.pngbin517 -> 0 bytes
-rw-r--r--res/drawable-hdpi/btn_tintable.9.pngbin0 -> 788 bytes
-rw-r--r--res/drawable-hdpi/calc_clear_symbol_tintable.png (renamed from res/drawable-hdpi/calc_clear_symbol.png)bin951 -> 760 bytes
-rw-r--r--res/drawable-hdpi/calculator_input_field.9.pngbin270 -> 0 bytes
-rw-r--r--res/drawable-hdpi/card_background.9.pngbin0 -> 207 bytes
-rw-r--r--res/drawable-hdpi/clear_history.pngbin3564 -> 0 bytes
-rw-r--r--res/drawable-hdpi/ic_menu_overflow.pngbin526 -> 0 bytes
-rw-r--r--res/drawable-hdpi/simple.pngbin3287 -> 0 bytes
-rw-r--r--res/drawable-mdpi/advanced.pngbin2085 -> 0 bytes
-rw-r--r--res/drawable-mdpi/btn_keyboard_key_dark_normal_holo.9.pngbin271 -> 0 bytes
-rw-r--r--res/drawable-mdpi/btn_keyboard_key_dark_pressed_holo.9.pngbin380 -> 0 bytes
-rw-r--r--res/drawable-mdpi/btn_keyboard_key_light_normal_holo.9.pngbin258 -> 0 bytes
-rw-r--r--res/drawable-mdpi/btn_keyboard_key_light_pressed_holo.9.pngbin368 -> 0 bytes
-rw-r--r--res/drawable-mdpi/calc_clear_symbol_tintable.png (renamed from res/drawable-mdpi/calc_clear_symbol.png)bin673 -> 482 bytes
-rw-r--r--res/drawable-mdpi/calculator_input_field.9.pngbin226 -> 0 bytes
-rw-r--r--res/drawable-mdpi/card_background.9.pngbin0 -> 157 bytes
-rw-r--r--res/drawable-mdpi/clear_history.pngbin2370 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_menu_overflow.pngbin445 -> 0 bytes
-rw-r--r--res/drawable-mdpi/simple.pngbin2206 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-hdpi/calc_clear_symbol.pngbin1970 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-hdpi/calc_clear_symbol_tintable.pngbin0 -> 1005 bytes
-rw-r--r--res/drawable-sw600dp-hdpi/calculator_input_field.9.pngbin1365 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-mdpi/calc_clear_symbol.pngbin1693 -> 0 bytes
-rw-r--r--res/drawable-sw600dp-mdpi/calc_clear_symbol_tintable.pngbin0 -> 714 bytes
-rw-r--r--res/drawable-sw600dp-mdpi/calculator_input_field.9.pngbin1262 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/btn_keyboard_key_dark_normal_holo.9.pngbin429 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/btn_keyboard_key_dark_pressed_holo.9.pngbin657 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/btn_keyboard_key_light_normal_holo.9.pngbin436 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/btn_keyboard_key_light_pressed_holo.9.pngbin634 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/calc_clear_symbol_tintable.png (renamed from res/drawable-xhdpi/calc_clear_symbol.png)bin1271 -> 1080 bytes
-rw-r--r--res/drawable-xhdpi/calculator_input_field.9.pngbin297 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/card_background.9.pngbin0 -> 250 bytes
-rw-r--r--res/drawable-xhdpi/ic_menu_overflow.pngbin554 -> 0 bytes
-rw-r--r--res/drawable-xxhdpi/calc_clear_symbol_tintable.pngbin0 -> 948 bytes
-rw-r--r--res/drawable/btn_advanced.xml18
-rw-r--r--res/drawable/btn_digit.xml15
-rw-r--r--res/drawable/btn_function.xml14
-rw-r--r--res/drawable/btn_stationary.xml22
-rw-r--r--res/drawable/calc_clear_symbol.xml3
-rw-r--r--res/drawable/shadow_bottom.xml9
-rw-r--r--res/drawable/shadow_right.xml9
-rw-r--r--res/drawable/shadow_top.xml9
-rw-r--r--res/layout-land/advanced_pad.xml103
-rw-r--r--res/layout-land/main.xml80
-rw-r--r--res/layout-land/simple_pad.xml169
-rw-r--r--res/layout-port/advanced_pad.xml120
-rw-r--r--res/layout-port/history_item.xml39
-rw-r--r--res/layout-port/main.xml92
-rw-r--r--res/layout-port/simple_pad.xml215
-rw-r--r--res/layout-sw600dp-land/main.xml274
-rw-r--r--res/layout-sw600dp/main.xml257
-rw-r--r--res/menu/menu.xml37
-rw-r--r--res/mipmap-hdpi/ic_launcher_calculator.pngbin18682 -> 6101 bytes
-rw-r--r--res/mipmap-mdpi/ic_launcher_calculator.pngbin15572 -> 2991 bytes
-rw-r--r--res/mipmap-xhdpi/ic_launcher_calculator.pngbin22274 -> 9693 bytes
-rw-r--r--res/mipmap-xxhdpi/ic_launcher_calculator.pngbin15056 -> 14219 bytes
-rw-r--r--res/mipmap-xxxhdpi/ic_launcher_calculator.pngbin24536 -> 23197 bytes
-rw-r--r--res/values-cs/strings.xml2
-rw-r--r--res/values-sw600dp/styles.xml4
-rw-r--r--res/values/colors.xml21
-rw-r--r--res/values/dimens.xml14
-rw-r--r--res/values/strings.xml76
-rw-r--r--res/values/styles.xml149
-rw-r--r--src/com/android/calculator2/Calculator.java190
-rw-r--r--src/com/android/calculator2/CalculatorDisplay.java16
-rw-r--r--src/com/android/calculator2/CalculatorEditText.java9
-rw-r--r--src/com/android/calculator2/CalculatorViewPager.java54
-rw-r--r--src/com/android/calculator2/ColorButton.java65
-rw-r--r--src/com/android/calculator2/EventListener.java7
-rw-r--r--src/com/android/calculator2/HistoryAdapter.java8
-rw-r--r--src/com/android/calculator2/Logic.java20
-rw-r--r--src/com/android/calculator2/SquareLinearLayout.java47
77 files changed, 1071 insertions, 1098 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 58f520c..130fe56 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -6,7 +6,7 @@
<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher_calculator">
<activity android:name="Calculator"
- android:theme="@android:style/Theme.Holo.NoActionBar"
+ android:theme="@android:style/Theme.Quantum.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/res/drawable-hdpi/advanced.png b/res/drawable-hdpi/advanced.png
deleted file mode 100644
index d4873af..0000000
--- a/res/drawable-hdpi/advanced.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/btn_keyboard_key_dark_normal_holo.9.png b/res/drawable-hdpi/btn_keyboard_key_dark_normal_holo.9.png
deleted file mode 100644
index 19bde28..0000000
--- a/res/drawable-hdpi/btn_keyboard_key_dark_normal_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/btn_keyboard_key_dark_pressed_holo.9.png b/res/drawable-hdpi/btn_keyboard_key_dark_pressed_holo.9.png
deleted file mode 100644
index 90abe39..0000000
--- a/res/drawable-hdpi/btn_keyboard_key_dark_pressed_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/btn_keyboard_key_light_normal_holo.9.png b/res/drawable-hdpi/btn_keyboard_key_light_normal_holo.9.png
deleted file mode 100644
index 713bfc1..0000000
--- a/res/drawable-hdpi/btn_keyboard_key_light_normal_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/btn_keyboard_key_light_pressed_holo.9.png b/res/drawable-hdpi/btn_keyboard_key_light_pressed_holo.9.png
deleted file mode 100644
index 6768241..0000000
--- a/res/drawable-hdpi/btn_keyboard_key_light_pressed_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/btn_tintable.9.png b/res/drawable-hdpi/btn_tintable.9.png
new file mode 100644
index 0000000..d060fcb
--- /dev/null
+++ b/res/drawable-hdpi/btn_tintable.9.png
Binary files differ
diff --git a/res/drawable-hdpi/calc_clear_symbol.png b/res/drawable-hdpi/calc_clear_symbol_tintable.png
index 3ce9dda..0095f30 100644
--- a/res/drawable-hdpi/calc_clear_symbol.png
+++ b/res/drawable-hdpi/calc_clear_symbol_tintable.png
Binary files differ
diff --git a/res/drawable-hdpi/calculator_input_field.9.png b/res/drawable-hdpi/calculator_input_field.9.png
deleted file mode 100644
index 49770cd..0000000
--- a/res/drawable-hdpi/calculator_input_field.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/card_background.9.png b/res/drawable-hdpi/card_background.9.png
new file mode 100644
index 0000000..bffcb47
--- /dev/null
+++ b/res/drawable-hdpi/card_background.9.png
Binary files differ
diff --git a/res/drawable-hdpi/clear_history.png b/res/drawable-hdpi/clear_history.png
deleted file mode 100644
index 14c2ef0..0000000
--- a/res/drawable-hdpi/clear_history.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_overflow.png b/res/drawable-hdpi/ic_menu_overflow.png
deleted file mode 100644
index a12aedf..0000000
--- a/res/drawable-hdpi/ic_menu_overflow.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/simple.png b/res/drawable-hdpi/simple.png
deleted file mode 100644
index d0e55fc..0000000
--- a/res/drawable-hdpi/simple.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/advanced.png b/res/drawable-mdpi/advanced.png
deleted file mode 100644
index 925d3b4..0000000
--- a/res/drawable-mdpi/advanced.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/btn_keyboard_key_dark_normal_holo.9.png b/res/drawable-mdpi/btn_keyboard_key_dark_normal_holo.9.png
deleted file mode 100644
index 4f27350..0000000
--- a/res/drawable-mdpi/btn_keyboard_key_dark_normal_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/btn_keyboard_key_dark_pressed_holo.9.png b/res/drawable-mdpi/btn_keyboard_key_dark_pressed_holo.9.png
deleted file mode 100644
index 4a92b80..0000000
--- a/res/drawable-mdpi/btn_keyboard_key_dark_pressed_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/btn_keyboard_key_light_normal_holo.9.png b/res/drawable-mdpi/btn_keyboard_key_light_normal_holo.9.png
deleted file mode 100644
index 37966f5..0000000
--- a/res/drawable-mdpi/btn_keyboard_key_light_normal_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/btn_keyboard_key_light_pressed_holo.9.png b/res/drawable-mdpi/btn_keyboard_key_light_pressed_holo.9.png
deleted file mode 100644
index 0493859..0000000
--- a/res/drawable-mdpi/btn_keyboard_key_light_pressed_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/calc_clear_symbol.png b/res/drawable-mdpi/calc_clear_symbol_tintable.png
index ac301e2..15dc1f2 100644
--- a/res/drawable-mdpi/calc_clear_symbol.png
+++ b/res/drawable-mdpi/calc_clear_symbol_tintable.png
Binary files differ
diff --git a/res/drawable-mdpi/calculator_input_field.9.png b/res/drawable-mdpi/calculator_input_field.9.png
deleted file mode 100644
index 6146973..0000000
--- a/res/drawable-mdpi/calculator_input_field.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/card_background.9.png b/res/drawable-mdpi/card_background.9.png
new file mode 100644
index 0000000..dd2f251
--- /dev/null
+++ b/res/drawable-mdpi/card_background.9.png
Binary files differ
diff --git a/res/drawable-mdpi/clear_history.png b/res/drawable-mdpi/clear_history.png
deleted file mode 100644
index b31e821..0000000
--- a/res/drawable-mdpi/clear_history.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_overflow.png b/res/drawable-mdpi/ic_menu_overflow.png
deleted file mode 100644
index 4a3bde3..0000000
--- a/res/drawable-mdpi/ic_menu_overflow.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/simple.png b/res/drawable-mdpi/simple.png
deleted file mode 100644
index 2a015c5..0000000
--- a/res/drawable-mdpi/simple.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/calc_clear_symbol.png b/res/drawable-sw600dp-hdpi/calc_clear_symbol.png
deleted file mode 100644
index 8ffc30e..0000000
--- a/res/drawable-sw600dp-hdpi/calc_clear_symbol.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/calc_clear_symbol_tintable.png b/res/drawable-sw600dp-hdpi/calc_clear_symbol_tintable.png
new file mode 100644
index 0000000..e998eae
--- /dev/null
+++ b/res/drawable-sw600dp-hdpi/calc_clear_symbol_tintable.png
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/calculator_input_field.9.png b/res/drawable-sw600dp-hdpi/calculator_input_field.9.png
deleted file mode 100644
index 555873c..0000000
--- a/res/drawable-sw600dp-hdpi/calculator_input_field.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/calc_clear_symbol.png b/res/drawable-sw600dp-mdpi/calc_clear_symbol.png
deleted file mode 100644
index 60dfecc..0000000
--- a/res/drawable-sw600dp-mdpi/calc_clear_symbol.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/calc_clear_symbol_tintable.png b/res/drawable-sw600dp-mdpi/calc_clear_symbol_tintable.png
new file mode 100644
index 0000000..74f4a63
--- /dev/null
+++ b/res/drawable-sw600dp-mdpi/calc_clear_symbol_tintable.png
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/calculator_input_field.9.png b/res/drawable-sw600dp-mdpi/calculator_input_field.9.png
deleted file mode 100644
index 679d4c8..0000000
--- a/res/drawable-sw600dp-mdpi/calculator_input_field.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/btn_keyboard_key_dark_normal_holo.9.png b/res/drawable-xhdpi/btn_keyboard_key_dark_normal_holo.9.png
deleted file mode 100644
index 1db8b6f..0000000
--- a/res/drawable-xhdpi/btn_keyboard_key_dark_normal_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_holo.9.png b/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_holo.9.png
deleted file mode 100644
index 84d1739..0000000
--- a/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/btn_keyboard_key_light_normal_holo.9.png b/res/drawable-xhdpi/btn_keyboard_key_light_normal_holo.9.png
deleted file mode 100644
index 1c3293d..0000000
--- a/res/drawable-xhdpi/btn_keyboard_key_light_normal_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/btn_keyboard_key_light_pressed_holo.9.png b/res/drawable-xhdpi/btn_keyboard_key_light_pressed_holo.9.png
deleted file mode 100644
index f770962..0000000
--- a/res/drawable-xhdpi/btn_keyboard_key_light_pressed_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/calc_clear_symbol.png b/res/drawable-xhdpi/calc_clear_symbol_tintable.png
index 570ff39..4c239bf 100644
--- a/res/drawable-xhdpi/calc_clear_symbol.png
+++ b/res/drawable-xhdpi/calc_clear_symbol_tintable.png
Binary files differ
diff --git a/res/drawable-xhdpi/calculator_input_field.9.png b/res/drawable-xhdpi/calculator_input_field.9.png
deleted file mode 100644
index b6adbbf..0000000
--- a/res/drawable-xhdpi/calculator_input_field.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/card_background.9.png b/res/drawable-xhdpi/card_background.9.png
new file mode 100644
index 0000000..68e9743
--- /dev/null
+++ b/res/drawable-xhdpi/card_background.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_overflow.png b/res/drawable-xhdpi/ic_menu_overflow.png
deleted file mode 100644
index 715cff8..0000000
--- a/res/drawable-xhdpi/ic_menu_overflow.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/calc_clear_symbol_tintable.png b/res/drawable-xxhdpi/calc_clear_symbol_tintable.png
new file mode 100644
index 0000000..8380d6d
--- /dev/null
+++ b/res/drawable-xxhdpi/calc_clear_symbol_tintable.png
Binary files differ
diff --git a/res/drawable/btn_advanced.xml b/res/drawable/btn_advanced.xml
new file mode 100644
index 0000000..f5d5190
--- /dev/null
+++ b/res/drawable/btn_advanced.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<touch-feedback xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/primary_dark" />
diff --git a/res/drawable/btn_digit.xml b/res/drawable/btn_digit.xml
index 2f91721..9890e08 100644
--- a/res/drawable/btn_digit.xml
+++ b/res/drawable/btn_digit.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
+<!--
+ Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,13 +14,5 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_pressed="true"
- android:drawable="@drawable/btn_keyboard_key_light_pressed_holo" />
- <item
- android:drawable="@drawable/btn_keyboard_key_light_normal_holo" />
-</selector>
+<touch-feedback xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/gray_50" />
diff --git a/res/drawable/btn_function.xml b/res/drawable/btn_function.xml
index 25a3e66..7440698 100644
--- a/res/drawable/btn_function.xml
+++ b/res/drawable/btn_function.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
+<!--
+ Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,12 +14,5 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-<selector
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item
- android:state_pressed="true"
- android:drawable="@drawable/btn_keyboard_key_dark_pressed_holo" />
- <item
- android:drawable="@drawable/btn_keyboard_key_dark_normal_holo" />
-</selector>
+<touch-feedback xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/gray_60" />
diff --git a/res/drawable/btn_stationary.xml b/res/drawable/btn_stationary.xml
new file mode 100644
index 0000000..a8d5b55
--- /dev/null
+++ b/res/drawable/btn_stationary.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<reveal xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item android:drawable="@color/primary_light"/>
+ <item android:drawable="@color/primary"/>
+
+</reveal> \ No newline at end of file
diff --git a/res/drawable/calc_clear_symbol.xml b/res/drawable/calc_clear_symbol.xml
new file mode 100644
index 0000000..5bbc3ab
--- /dev/null
+++ b/res/drawable/calc_clear_symbol.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/calc_clear_symbol_tintable" />
diff --git a/res/drawable/shadow_bottom.xml b/res/drawable/shadow_bottom.xml
new file mode 100644
index 0000000..e07dfdf
--- /dev/null
+++ b/res/drawable/shadow_bottom.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <gradient
+ android:angle="90"
+ android:endColor="#C0000000"
+ android:startColor="#00000000" />
+
+</shape> \ No newline at end of file
diff --git a/res/drawable/shadow_right.xml b/res/drawable/shadow_right.xml
new file mode 100644
index 0000000..c842311
--- /dev/null
+++ b/res/drawable/shadow_right.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <gradient
+ android:angle="0"
+ android:endColor="#33000000"
+ android:startColor="#00000000" />
+
+</shape> \ No newline at end of file
diff --git a/res/drawable/shadow_top.xml b/res/drawable/shadow_top.xml
new file mode 100644
index 0000000..fa30d3e
--- /dev/null
+++ b/res/drawable/shadow_top.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <gradient
+ android:angle="270"
+ android:endColor="#C0000000"
+ android:startColor="#00000000" />
+
+</shape> \ No newline at end of file
diff --git a/res/layout-land/advanced_pad.xml b/res/layout-land/advanced_pad.xml
index 5b8f98b..d2a3ffc 100644
--- a/res/layout-land/advanced_pad.xml
+++ b/res/layout-land/advanced_pad.xml
@@ -19,85 +19,84 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/advancedPad"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:orientation="vertical"
- android:layout_gravity="center"
- >
+ android:id="@+id/advancedPad"
+ style="@style/advanced_pad"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:layout_weight="1"
+ android:orientation="vertical" >
<LinearLayout
- android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ android:layout_weight="1" >
+
+ <Button
android:id="@+id/sin"
- android:text="@string/sin"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/sinDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/sin" />
+
+ <Button
android:id="@+id/cos"
- android:text="@string/cos"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/cosDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/cos" />
+
+ <Button
android:id="@+id/tan"
- android:text="@string/tan"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/tanDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/tan" />
+
+ <Button
android:id="@+id/pi"
- android:text="@string/pi"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/piDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/pi" />
+
+ <Button
android:id="@+id/factorial"
- android:text="@string/factorial"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/factorialDesc"
- />
+ android:text="@string/factorial" />
</LinearLayout>
<LinearLayout
- android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ android:layout_weight="1" >
+
+ <Button
android:id="@+id/ln"
- android:text="@string/ln"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/lnDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/ln" />
+
+ <Button
android:id="@+id/lg"
- android:text="@string/lg"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/lgDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/lg" />
+
+ <Button
android:id="@+id/e"
- android:text="@string/e"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/eDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/e" />
+
+ <Button
android:id="@+id/power"
- android:text="@string/power"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/powerDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/power" />
+
+ <Button
android:id="@+id/sqrt"
- android:text="@string/sqrt"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/sqrtDesc"
- />
+ android:text="@string/sqrt" />
</LinearLayout>
-</LinearLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-land/main.xml b/res/layout-land/main.xml
index c8a1216..34aaf44 100644
--- a/res/layout-land/main.xml
+++ b/res/layout-land/main.xml
@@ -19,62 +19,50 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#ff000000">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
<LinearLayout
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="2"
- >
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
<com.android.calculator2.CalculatorDisplay
- android:id="@+id/display"
- android:layout_width="0dp"
- android:layout_weight="5"
- android:layout_height="match_parent"
- maxDigits="@integer/max_digits">
+ android:id="@+id/display"
+ style="@style/display_holder_style"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ maxDigits="@integer/max_digits" >
- <com.android.calculator2.CalculatorEditText
- style="@style/display_style" />
- <com.android.calculator2.CalculatorEditText
- style="@style/display_style" />
+ <com.android.calculator2.CalculatorEditText style="@style/display_style" />
+ <com.android.calculator2.CalculatorEditText style="@style/display_style" />
</com.android.calculator2.CalculatorDisplay>
- <ImageButton android:id="@+id/overflow_menu"
- android:layout_width="48dip"
- android:layout_height="match_parent"
- android:src="@drawable/ic_menu_overflow"
- android:background="@android:color/transparent"
- android:layout_marginLeft="8dip"
- android:visibility="gone"/>
+
<FrameLayout
android:layout_width="100dp"
- android:layout_height="match_parent">
- <!-- marginRight has to be 0 to catch border-touch -->
- <com.android.calculator2.ColorButton
- android:id="@+id/clear"
- android:text="@string/clear"
- android:textSize="15dp"
- style="@style/button_style"
- />
- <!-- marginRight has to be 0 to catch border-touch -->
- <com.android.calculator2.ColorButton
- android:id="@+id/del"
- android:text="@string/del"
- android:textSize="15dp"
- style="@style/button_style"
- android:contentDescription="@string/delDesc"
- />
+ android:layout_height="match_parent" >
+
+ <Button
+ android:id="@+id/clear"
+ style="@style/stationary_button"
+ android:text="@string/clear"
+ android:textSize="15dp" />
+
+ <Button
+ android:id="@+id/del"
+ style="@style/stationary_button"
+ android:contentDescription="@string/delDesc"
+ android:text="@string/del"
+ android:textSize="15dp" />
</FrameLayout>
</LinearLayout>
<com.android.calculator2.CalculatorViewPager
- android:id="@+id/panelswitch"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="4"
- />
+ android:id="@+id/panelswitch"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
-</LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-land/simple_pad.xml b/res/layout-land/simple_pad.xml
index 271cb0e..aa102f0 100644
--- a/res/layout-land/simple_pad.xml
+++ b/res/layout-land/simple_pad.xml
@@ -19,128 +19,127 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/simplePad"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_gravity="center"
- >
+ android:id="@+id/simplePad"
+ style="@style/digit_pad"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:orientation="vertical" >
+
<LinearLayout
- android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ android:layout_weight="1" >
+
+ <Button
android:id="@+id/digit7"
- android:text="@string/digit7"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit7" />
+
+ <Button
android:id="@+id/digit8"
- android:text="@string/digit8"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit8" />
+
+ <Button
android:id="@+id/digit9"
- android:text="@string/digit9"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit9" />
+
+ <Button
android:id="@+id/leftParen"
- android:text="@string/leftParen"
- style="@style/button_style"
+ style="@style/function_button"
android:contentDescription="@string/leftParenDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/leftParen" />
+
+ <Button
android:id="@+id/rightParen"
- android:text="@string/rightParen"
- style="@style/button_style"
+ style="@style/function_button"
android:contentDescription="@string/rightParenDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/rightParen" />
+
+ <Button
android:id="@+id/mul"
- android:text="@string/mul"
- style="@style/button_style"
+ style="@style/function_button"
android:contentDescription="@string/mulDesc"
- />
+ android:text="@string/mul" />
</LinearLayout>
<LinearLayout
- android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ android:layout_weight="1" >
+
+ <Button
android:id="@+id/digit4"
- android:text="@string/digit4"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit4" />
+
+ <Button
android:id="@+id/digit5"
- android:text="@string/digit5"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit5" />
+
+ <Button
android:id="@+id/digit6"
- android:text="@string/digit6"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit6" />
+
+ <Button
android:id="@+id/dot"
- android:text="@string/dot"
- style="@style/digit_button_style"
+ style="@style/digit_button"
android:contentDescription="@string/dotDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/dot" />
+
+ <Button
android:id="@+id/div"
- android:text="@string/div"
- style="@style/button_style"
+ style="@style/function_button"
android:contentDescription="@string/divDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/div" />
+
+ <Button
android:id="@+id/minus"
- android:text="@string/minus"
- style="@style/button_style"
+ style="@style/function_button"
android:contentDescription="@string/minusDesc"
- />
+ android:text="@string/minus" />
</LinearLayout>
<LinearLayout
- android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ android:layout_weight="1" >
+
+ <Button
android:id="@+id/digit1"
- android:text="@string/digit1"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit1" />
+
+ <Button
android:id="@+id/digit2"
- android:text="@string/digit2"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit2" />
+
+ <Button
android:id="@+id/digit3"
- android:text="@string/digit3"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit3" />
+
+ <Button
android:id="@+id/digit0"
- android:text="@string/digit0"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ style="@style/digit_button"
+ android:text="@string/digit0" />
+
+ <Button
android:id="@+id/equal"
- android:text="@string/equal"
- style="@style/button_style"
+ style="@style/function_button"
android:contentDescription="@string/equalDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/equal" />
+
+ <Button
android:id="@+id/plus"
- android:text="@string/plus"
- style="@style/button_style"
+ style="@style/function_button"
android:contentDescription="@string/plusDesc"
- />
+ android:text="@string/plus" />
</LinearLayout>
-</LinearLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-port/advanced_pad.xml b/res/layout-port/advanced_pad.xml
index 843c54d..73409f1 100644
--- a/res/layout-port/advanced_pad.xml
+++ b/res/layout-port/advanced_pad.xml
@@ -19,110 +19,106 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/advancedPad"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_gravity="center"
- >
+ android:id="@+id/advancedPad"
+ style="@style/advanced_pad"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
<LinearLayout
- android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ android:layout_weight="1" >
+
+ <Button
android:id="@+id/sin"
- android:text="@string/sin"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/sinDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/sin" />
+
+ <Button
android:id="@+id/cos"
- android:text="@string/cos"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/cosDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/cos" />
+
+ <Button
android:id="@+id/tan"
- android:text="@string/tan"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/tanDesc"
- />
+ android:text="@string/tan" />
</LinearLayout>
<LinearLayout
- android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ android:layout_weight="1" >
+
+ <Button
android:id="@+id/ln"
- android:text="@string/ln"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/lnDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/ln" />
+
+ <Button
android:id="@+id/lg"
- android:text="@string/lg"
- style="@style/button_small_style"
+ style="@style/advanced_button_small"
android:contentDescription="@string/lgDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/lg" />
+
+ <Button
android:id="@+id/factorial"
- android:text="@string/factorial"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/factorialDesc"
- />
+ android:text="@string/factorial" />
</LinearLayout>
<LinearLayout
- android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ android:layout_weight="1" >
+
+ <Button
android:id="@+id/pi"
- android:text="@string/pi"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/piDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/pi" />
+
+ <Button
android:id="@+id/e"
- android:text="@string/e"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/eDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/e" />
+
+ <Button
android:id="@+id/power"
- android:text="@string/power"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/powerDesc"
- />
+ android:text="@string/power" />
</LinearLayout>
<LinearLayout
- android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ android:layout_weight="1" >
+
+ <Button
android:id="@+id/leftParen"
- android:text="@string/leftParen"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/leftParenDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/leftParen" />
+
+ <Button
android:id="@+id/rightParen"
- android:text="@string/rightParen"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/rightParenDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/rightParen" />
+
+ <Button
android:id="@+id/sqrt"
- android:text="@string/sqrt"
- style="@style/button_style"
+ style="@style/advanced_button"
android:contentDescription="@string/sqrtDesc"
- />
+ android:text="@string/sqrt" />
</LinearLayout>
+
</LinearLayout>
diff --git a/res/layout-port/history_item.xml b/res/layout-port/history_item.xml
index 2147da7..61f7099 100644
--- a/res/layout-port/history_item.xml
+++ b/res/layout-port/history_item.xml
@@ -1,26 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- >
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/card_background"
+ android:padding="8dp"
+ android:orientation="vertical" >
- <TextView
- android:id="@+id/historyExpr"
- android:layout_width="0px"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textSize="23dp"
- android:singleLine="true"
- />
+ <TextView
+ android:id="@+id/historyExpr"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textSize="24sp" />
<TextView
- android:id="@+id/historyResult"
- android:layout_width="180px"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:textSize="23dp"
- android:singleLine="true"
- />
+ android:id="@+id/historyResult"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textSize="48sp" />
-</LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-port/main.xml b/res/layout-port/main.xml
index e4e3c1a..64638bc 100644
--- a/res/layout-port/main.xml
+++ b/res/layout-port/main.xml
@@ -19,87 +19,25 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#ff000000">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
- <LinearLayout
+ <com.android.calculator2.CalculatorDisplay
+ android:id="@+id/display"
+ style="@style/display_holder_style"
android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="3"
- android:orientation="horizontal"
- android:layout_gravity="center_vertical"
- android:gravity="center_vertical">
+ android:layout_height="wrap_content"
+ maxDigits="@integer/max_digits" >
- <com.android.calculator2.CalculatorDisplay
- android:id="@+id/display"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- maxDigits="@integer/max_digits">
+ <com.android.calculator2.CalculatorEditText style="@style/display_style" />
- <com.android.calculator2.CalculatorEditText
- style="@style/display_style" />
- <com.android.calculator2.CalculatorEditText
- style="@style/display_style" />
+ <com.android.calculator2.CalculatorEditText style="@style/display_style" />
+ </com.android.calculator2.CalculatorDisplay>
- </com.android.calculator2.CalculatorDisplay>
- <ImageButton android:id="@+id/overflow_menu"
- android:layout_width="48dip"
- android:layout_height="match_parent"
- android:src="@drawable/ic_menu_overflow"
- android:background="@android:color/transparent"
- android:layout_marginLeft="8dip"
- android:visibility="gone"/>
- </LinearLayout>
- <LinearLayout
+ <com.android.calculator2.CalculatorViewPager
+ android:id="@+id/panelswitch"
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1.5"
- >
-
- <View
- android:background="@drawable/btn_function"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- />
+ android:layout_height="360dp" />
- <FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent">
- <!-- marginRight has to be 0 to catch border-touch -->
- <com.android.calculator2.ColorButton
- android:id="@+id/clear"
- android:text="@string/clear"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginRight="0dp"
- android:textSize="15dp"
- style="@style/button_style"
- android:minWidth="89dip"
- />
- <!-- marginRight has to be 0 to catch border-touch -->
- <com.android.calculator2.ColorButton
- android:id="@+id/del"
- android:text="@string/del"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginRight="0dp"
- android:textSize="15dp"
- style="@style/button_style"
- android:contentDescription="@string/delDesc"
- android:ellipsize="end"
- android:minWidth="89dip"
- />
- </FrameLayout>
-
- </LinearLayout>
- <com.android.calculator2.CalculatorViewPager
- android:id="@+id/panelswitch"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="10"
- />
-</LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-port/simple_pad.xml b/res/layout-port/simple_pad.xml
index 1d8b535..606e16a 100644
--- a/res/layout-port/simple_pad.xml
+++ b/res/layout-port/simple_pad.xml
@@ -19,123 +19,134 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/simplePad"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_gravity="center"
- >
+ android:id="@+id/simplePad"
+ style="@style/digit_pad"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:baselineAligned="true"
+ android:orientation="horizontal" >
<LinearLayout
- android:layout_weight="3"
- android:layout_width="match_parent"
- android:layout_height="0dp">
- <com.android.calculator2.ColorButton
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical" >
+
+ <Button
android:id="@+id/digit7"
- android:text="@string/digit7"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
- android:id="@+id/digit8"
- android:text="@string/digit8"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
- android:id="@+id/digit9"
- android:text="@string/digit9"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
- android:id="@+id/div"
- android:text="@string/div"
- style="@style/button_style"
- android:contentDescription="@string/divDesc"
- />
- </LinearLayout>
+ style="@style/digit_button"
+ android:text="@string/digit7" />
- <LinearLayout
- android:layout_weight="3"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
+ <Button
android:id="@+id/digit4"
- android:text="@string/digit4"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
- android:id="@+id/digit5"
- android:text="@string/digit5"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
- android:id="@+id/digit6"
- android:text="@string/digit6"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
- android:id="@+id/mul"
- android:text="@string/mul"
- style="@style/button_style"
- android:contentDescription="@string/mulDesc"
- />
+ style="@style/digit_button"
+ android:text="@string/digit4" />
+
+ <Button
+ android:id="@+id/digit1"
+ style="@style/digit_button"
+ android:text="@string/digit1" />
+
+ <Button
+ android:id="@+id/dot"
+ style="@style/digit_button"
+ android:contentDescription="@string/dotDesc"
+ android:text="@string/dot" />
</LinearLayout>
<LinearLayout
- android:layout_weight="3"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
- android:id="@+id/digit1"
- android:text="@string/digit1"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical" >
+
+ <Button
+ android:id="@+id/digit8"
+ style="@style/digit_button"
+ android:text="@string/digit8" />
+
+ <Button
+ android:id="@+id/digit5"
+ style="@style/digit_button"
+ android:text="@string/digit5" />
+
+ <Button
android:id="@+id/digit2"
- android:text="@string/digit2"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
- android:id="@+id/digit3"
- android:text="@string/digit3"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
- android:id="@+id/minus"
- android:text="@string/minus"
- style="@style/button_style"
- android:contentDescription="@string/minusDesc"
- />
+ style="@style/digit_button"
+ android:text="@string/digit2" />
+
+ <Button
+ android:id="@+id/digit0"
+ style="@style/digit_button"
+ android:text="@string/digit0" />
</LinearLayout>
<LinearLayout
- android:layout_weight="3"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- >
- <com.android.calculator2.ColorButton
- android:id="@+id/dot"
- android:text="@string/dot"
- style="@style/digit_button_style"
- android:contentDescription="@string/dotDesc"
- />
- <com.android.calculator2.ColorButton
- android:id="@+id/digit0"
- android:text="@string/digit0"
- style="@style/digit_button_style"
- />
- <com.android.calculator2.ColorButton
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical" >
+
+ <Button
+ android:id="@+id/digit9"
+ style="@style/digit_button"
+ android:text="@string/digit9" />
+
+ <Button
+ android:id="@+id/digit6"
+ style="@style/digit_button"
+ android:text="@string/digit6" />
+
+ <Button
+ android:id="@+id/digit3"
+ style="@style/digit_button"
+ android:text="@string/digit3" />
+
+ <Button
android:id="@+id/equal"
- android:text="@string/equal"
- style="@style/button_style"
+ style="@style/digit_button"
android:contentDescription="@string/equalDesc"
- />
- <com.android.calculator2.ColorButton
+ android:text="@string/equal" />
+ </LinearLayout>
+
+ <LinearLayout
+ style="@style/function_pad"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical" >
+
+ <ImageButton
+ android:id="@+id/del"
+ style="@style/function_button"
+ android:contentDescription="@string/delDesc"
+ android:src="@drawable/calc_clear_symbol"
+ android:text="@string/del"
+ android:textSize="@dimen/small_text_size" />
+
+ <Button
+ android:id="@+id/div"
+ style="@style/function_button"
+ android:contentDescription="@string/divDesc"
+ android:text="@string/div" />
+
+ <Button
+ android:id="@+id/mul"
+ style="@style/function_button"
+ android:contentDescription="@string/mulDesc"
+ android:text="@string/mul" />
+
+ <Button
+ android:id="@+id/minus"
+ style="@style/function_button"
+ android:contentDescription="@string/minusDesc"
+ android:text="@string/minus" />
+
+ <Button
android:id="@+id/plus"
- android:text="@string/plus"
- style="@style/button_style"
+ style="@style/function_button"
android:contentDescription="@string/plusDesc"
- />
+ android:text="@string/plus" />
</LinearLayout>
+
</LinearLayout>
diff --git a/res/layout-sw600dp-land/main.xml b/res/layout-sw600dp-land/main.xml
index 3a86293..9392f5a 100644
--- a/res/layout-sw600dp-land/main.xml
+++ b/res/layout-sw600dp-land/main.xml
@@ -16,62 +16,59 @@
* limitations under the License.
*/
-->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="#ff000000"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/top_bottom_padding"
android:paddingLeft="@dimen/left_right_padding"
android:paddingRight="@dimen/left_right_padding"
- android:paddingTop="@dimen/top_bottom_padding"
- android:paddingBottom="@dimen/top_bottom_padding">
+ android:paddingTop="@dimen/top_bottom_padding" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/group_padding"
- android:background="@drawable/calculator_input_field">
+ android:orientation="horizontal" >
<com.android.calculator2.CalculatorDisplay
android:id="@+id/display"
+ style="@style/display_holder_style"
android:layout_width="0dip"
- android:layout_weight="1"
android:layout_height="wrap_content"
- maxDigits="@integer/max_digits"
- android:layout_alignParentTop="true"
- >
+ android:layout_weight="1"
+ maxDigits="@integer/max_digits" >
- <com.android.calculator2.CalculatorEditText
- style="@style/display_style" />
- <com.android.calculator2.CalculatorEditText
- style="@style/display_style" />
+ <com.android.calculator2.CalculatorEditText style="@style/display_style" />
+ <com.android.calculator2.CalculatorEditText style="@style/display_style" />
</com.android.calculator2.CalculatorDisplay>
<FrameLayout
android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentTop="true">
+ android:layout_height="match_parent" >
+
<Button
android:id="@+id/clear"
- android:text="@string/clear"
style="@style/btn_clear"
- android:minWidth="100dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:contentDescription="@string/clearDesc"
+ android:minWidth="100dp"
android:paddingLeft="5dip"
android:paddingRight="5dip"
- android:contentDescription="@string/clearDesc" />
+ android:text="@string/clear" />
+
<ImageButton
android:id="@+id/del"
- android:src="@drawable/calc_clear_symbol"
style="@style/btn_clear"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:contentDescription="@string/delDesc"
android:paddingLeft="5dip"
android:paddingRight="5dip"
- android:contentDescription="@string/delDesc" />
+ android:src="@drawable/calc_clear_symbol_tintable"
+ android:visibility="invisible" />
</FrameLayout>
</LinearLayout>
@@ -79,78 +76,90 @@
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="4"
- android:orientation="horizontal">
+ android:baselineAligned="false"
+ android:orientation="horizontal" >
<LinearLayout
+ style="@style/advanced_pad"
android:layout_width="0dip"
android:layout_height="match_parent"
+ android:layout_marginRight="@dimen/group_padding"
android:layout_weight="2"
- android:orientation="vertical"
- android:layout_marginRight="@dimen/group_padding">
- <LinearLayout
- style="@style/btn_row_style">
+ android:orientation="vertical" >
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/sin"
- android:text="@string/sin"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/sinDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/sinDesc"
+ android:text="@string/sin" />
+
<Button
android:id="@+id/ln"
- android:text="@string/ln"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/lnDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/lnDesc"
+ android:text="@string/ln" />
</LinearLayout>
- <LinearLayout
- style="@style/btn_row_style">
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/cos"
- android:text="@string/cos"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/cosDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/cosDesc"
+ android:text="@string/cos" />
+
<Button
android:id="@+id/lg"
- android:text="@string/lg"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/lgDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/lgDesc"
+ android:text="@string/lg" />
</LinearLayout>
- <LinearLayout
- style="@style/btn_row_style">
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/tan"
- android:text="@string/tan"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/tanDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/tanDesc"
+ android:text="@string/tan" />
+
<Button
android:id="@+id/e"
- android:text="@string/e"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/eDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/eDesc"
+ android:text="@string/e" />
</LinearLayout>
- <LinearLayout
- style="@style/btn_row_style">
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/pi"
- android:text="@string/pi"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/piDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/piDesc"
+ android:text="@string/pi" />
+
<Button
android:id="@+id/power"
- android:text="@string/power"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/powerDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/powerDesc"
+ android:text="@string/power" />
</LinearLayout>
- <LinearLayout
- style="@style/btn_row_style">
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/factorial"
- android:text="@string/factorial"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/factorialDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/factorialDesc"
+ android:text="@string/factorial" />
+
<Button
android:id="@+id/sqrt"
- android:text="@string/sqrt"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/sqrtDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/sqrtDesc"
+ android:text="@string/sqrt" />
</LinearLayout>
</LinearLayout>
@@ -158,112 +167,133 @@
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="5"
- android:orientation="vertical">
- <LinearLayout
- style="@style/btn_row_style">
+ android:orientation="vertical" >
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/digit7"
- android:text="@string/digit7"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit7" />
+
<Button
android:id="@+id/digit8"
- android:text="@string/digit8"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit8" />
+
<Button
android:id="@+id/digit9"
- android:text="@string/digit9"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit9" />
+
<Button
android:id="@+id/div"
- android:text="@string/div"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/divDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/divDesc"
+ android:text="@string/div" />
+
<Button
android:id="@+id/leftParen"
- android:text="@string/leftParen"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/leftParenDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/leftParenDesc"
+ android:text="@string/leftParen" />
</LinearLayout>
- <LinearLayout
- style="@style/btn_row_style">
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/digit4"
- android:text="@string/digit4"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit4" />
+
<Button
android:id="@+id/digit5"
- android:text="@string/digit5"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit5" />
+
<Button
android:id="@+id/digit6"
- android:text="@string/digit6"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit6" />
+
<Button
android:id="@+id/mul"
- android:text="@string/mul"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/mulDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/mulDesc"
+ android:text="@string/mul" />
+
<Button
android:id="@+id/rightParen"
- android:text="@string/rightParen"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/rightParenDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/rightParenDesc"
+ android:text="@string/rightParen" />
</LinearLayout>
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="2"
- android:orientation="horizontal">
+ android:orientation="horizontal" >
+
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="4"
- android:orientation="vertical">
- <LinearLayout
- style="@style/btn_row_style">
+ android:orientation="vertical" >
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/digit1"
- android:text="@string/digit1"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit1" />
+
<Button
android:id="@+id/digit2"
- android:text="@string/digit2"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit2" />
+
<Button
android:id="@+id/digit3"
- android:text="@string/digit3"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit3" />
+
<Button
android:id="@+id/minus"
- android:text="@string/minus"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/minusDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/minusDesc"
+ android:text="@string/minus" />
</LinearLayout>
- <LinearLayout
- style="@style/btn_row_style">
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/digit0"
- android:text="@string/digit0"
- style="@style/btn_digit_cell_style"
- android:layout_weight="2" />
+ style="@style/digit_button_sw600"
+ android:layout_weight="2"
+ android:text="@string/digit0" />
+
<Button
android:id="@+id/dot"
- android:text="@string/dot"
- style="@style/btn_digit_cell_style"
- android:contentDescription="@string/dotDesc" />
+ style="@style/digit_button_sw600"
+ android:contentDescription="@string/dotDesc"
+ android:text="@string/dot" />
+
<Button
android:id="@+id/plus"
- android:text="@string/plus"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/plusDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/plusDesc"
+ android:text="@string/plus" />
</LinearLayout>
</LinearLayout>
+
<Button
android:id="@+id/equal"
- android:text="@string/equal"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/equalDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/equalDesc"
+ android:text="@string/equal" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
-</LinearLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-sw600dp/main.xml b/res/layout-sw600dp/main.xml
index 89df4de..9ede6f3 100644
--- a/res/layout-sw600dp/main.xml
+++ b/res/layout-sw600dp/main.xml
@@ -17,238 +17,267 @@
*/
-->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="#ff000000"
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/top_bottom_padding"
android:paddingLeft="@dimen/left_right_padding"
android:paddingRight="@dimen/left_right_padding"
- android:paddingTop="@dimen/top_bottom_padding"
- android:paddingBottom="@dimen/top_bottom_padding">
+ android:paddingTop="@dimen/top_bottom_padding" >
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/group_padding"
- android:background="@drawable/calculator_input_field">
+ android:orientation="horizontal" >
<com.android.calculator2.CalculatorDisplay
android:id="@+id/display"
+ style="@style/display_holder_style"
android:layout_width="0dp"
- android:layout_weight="1"
android:layout_height="wrap_content"
- maxDigits="@integer/max_digits"
android:layout_gravity="bottom"
- >
+ android:layout_weight="1"
+ maxDigits="@integer/max_digits" >
- <com.android.calculator2.CalculatorEditText
- style="@style/display_style" />
- <com.android.calculator2.CalculatorEditText
- style="@style/display_style" />
+ <com.android.calculator2.CalculatorEditText style="@style/display_style" />
+ <com.android.calculator2.CalculatorEditText style="@style/display_style" />
</com.android.calculator2.CalculatorDisplay>
<FrameLayout
android:layout_width="wrap_content"
- android:layout_height="match_parent">
+ android:layout_height="match_parent" >
+
<Button
android:id="@+id/clear"
- android:text="@string/clear"
style="@style/btn_clear"
- android:minWidth="100dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:contentDescription="@string/clearDesc"
+ android:minWidth="100dp"
android:paddingLeft="5dip"
android:paddingRight="5dip"
- android:contentDescription="@string/clearDesc" />
+ android:text="@string/clear" />
+
<ImageButton
android:id="@+id/del"
- android:src="@drawable/calc_clear_symbol"
style="@style/btn_clear"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:contentDescription="@string/delDesc"
android:paddingLeft="5dip"
android:paddingRight="5dip"
- android:contentDescription="@string/delDesc" />
+ android:src="@drawable/calc_clear_symbol_tintable"
+ android:visibility="invisible" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
+ android:layout_marginBottom="@dimen/group_padding"
android:layout_weight="2"
- android:orientation="vertical"
- android:layout_marginBottom="@dimen/group_padding">
+ android:orientation="vertical" >
+
+ <LinearLayout style="@style/btn_row_style" >
- <LinearLayout
- style="@style/btn_row_style">
<Button
android:id="@+id/sin"
- android:text="@string/sin"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/sinDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/sinDesc"
+ android:text="@string/sin" />
+
<Button
android:id="@+id/cos"
- android:text="@string/cos"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/cosDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/cosDesc"
+ android:text="@string/cos" />
+
<Button
android:id="@+id/tan"
- android:text="@string/tan"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/tanDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/tanDesc"
+ android:text="@string/tan" />
+
<Button
android:id="@+id/pi"
- android:text="@string/pi"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/piDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/piDesc"
+ android:text="@string/pi" />
+
<Button
android:id="@+id/factorial"
- android:text="@string/factorial"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/factorialDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/factorialDesc"
+ android:text="@string/factorial" />
</LinearLayout>
- <LinearLayout
- style="@style/btn_row_style">
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/ln"
- android:text="@string/ln"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/lnDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/lnDesc"
+ android:text="@string/ln" />
+
<Button
android:id="@+id/lg"
- android:text="@string/lg"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/lgDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/lgDesc"
+ android:text="@string/lg" />
+
<Button
android:id="@+id/e"
- android:text="@string/e"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/eDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/eDesc"
+ android:text="@string/e" />
+
<Button
android:id="@+id/power"
- android:text="@string/power"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/powerDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/powerDesc"
+ android:text="@string/power" />
+
<Button
android:id="@+id/sqrt"
- android:text="@string/sqrt"
- style="@style/btn_function_cell_style"
- android:contentDescription="@string/sqrtDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/sqrtDesc"
+ android:text="@string/sqrt" />
</LinearLayout>
-
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="5"
- android:orientation="vertical">
- <LinearLayout
- style="@style/btn_row_style">
+ android:orientation="vertical" >
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/digit7"
- android:text="@string/digit7"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit7" />
+
<Button
android:id="@+id/digit8"
- android:text="@string/digit8"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit8" />
+
<Button
android:id="@+id/digit9"
- android:text="@string/digit9"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit9" />
+
<Button
android:id="@+id/div"
- android:text="@string/div"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/divDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/divDesc"
+ android:text="@string/div" />
+
<Button
android:id="@+id/leftParen"
- android:text="@string/leftParen"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/leftParenDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/leftParenDesc"
+ android:text="@string/leftParen" />
</LinearLayout>
- <LinearLayout
- style="@style/btn_row_style">
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/digit4"
- android:text="@string/digit4"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit4" />
+
<Button
android:id="@+id/digit5"
- android:text="@string/digit5"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit5" />
+
<Button
android:id="@+id/digit6"
- android:text="@string/digit6"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit6" />
+
<Button
android:id="@+id/mul"
- android:text="@string/mul"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/mulDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/mulDesc"
+ android:text="@string/mul" />
+
<Button
android:id="@+id/rightParen"
- android:text="@string/rightParen"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/rightParenDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/rightParenDesc"
+ android:text="@string/rightParen" />
</LinearLayout>
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="2"
- android:orientation="horizontal">
+ android:orientation="horizontal" >
+
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="4"
- android:orientation="vertical">
- <LinearLayout
- style="@style/btn_row_style">
+ android:orientation="vertical" >
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/digit1"
- android:text="@string/digit1"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit1" />
+
<Button
android:id="@+id/digit2"
- android:text="@string/digit2"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit2" />
+
<Button
android:id="@+id/digit3"
- android:text="@string/digit3"
- style="@style/btn_digit_cell_style" />
+ style="@style/digit_button_sw600"
+ android:text="@string/digit3" />
+
<Button
android:id="@+id/minus"
- android:text="@string/minus"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/minusDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/minusDesc"
+ android:text="@string/minus" />
</LinearLayout>
- <LinearLayout
- style="@style/btn_row_style">
+
+ <LinearLayout style="@style/btn_row_style" >
+
<Button
android:id="@+id/digit0"
- android:text="@string/digit0"
- style="@style/btn_digit_cell_style"
- android:layout_weight="2" />
+ style="@style/digit_button_sw600"
+ android:layout_weight="2"
+ android:text="@string/digit0" />
+
<Button
android:id="@+id/dot"
- android:text="@string/dot"
- style="@style/btn_digit_cell_style"
- android:contentDescription="@string/dotDesc" />
+ style="@style/digit_button_sw600"
+ android:contentDescription="@string/dotDesc"
+ android:text="@string/dot" />
+
<Button
android:id="@+id/plus"
- android:text="@string/plus"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/plusDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/plusDesc"
+ android:text="@string/plus" />
</LinearLayout>
</LinearLayout>
+
<Button
android:id="@+id/equal"
- android:text="@string/equal"
- style="@style/btn_operation_cell_style"
- android:contentDescription="@string/equalDesc" />
+ style="@style/function_button_sw600"
+ android:contentDescription="@string/equalDesc"
+ android:text="@string/equal" />
</LinearLayout>
</LinearLayout>
-</LinearLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/menu/menu.xml b/res/menu/menu.xml
deleted file mode 100644
index 21eb71a..0000000
--- a/res/menu/menu.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright (C) 2011, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:id="@+id/clear_history"
- android:showAsAction="ifRoom|withText"
- android:icon="@drawable/clear_history"
- android:title="@string/clear_history"/>
-
- <item android:id="@+id/advanced"
- android:showAsAction="ifRoom|withText"
- android:icon="@drawable/advanced"
- android:title="@string/advanced"/>
-
- <item android:id="@+id/basic"
- android:showAsAction="ifRoom|withText"
- android:icon="@drawable/simple"
- android:title="@string/basic"/>
-
-</menu>
diff --git a/res/mipmap-hdpi/ic_launcher_calculator.png b/res/mipmap-hdpi/ic_launcher_calculator.png
index 008c565..9ab10bc 100644
--- a/res/mipmap-hdpi/ic_launcher_calculator.png
+++ b/res/mipmap-hdpi/ic_launcher_calculator.png
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_calculator.png b/res/mipmap-mdpi/ic_launcher_calculator.png
index 8f02ef1..4344be6 100644
--- a/res/mipmap-mdpi/ic_launcher_calculator.png
+++ b/res/mipmap-mdpi/ic_launcher_calculator.png
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_calculator.png b/res/mipmap-xhdpi/ic_launcher_calculator.png
index 9636c19..aa955e2 100644
--- a/res/mipmap-xhdpi/ic_launcher_calculator.png
+++ b/res/mipmap-xhdpi/ic_launcher_calculator.png
Binary files differ
diff --git a/res/mipmap-xxhdpi/ic_launcher_calculator.png b/res/mipmap-xxhdpi/ic_launcher_calculator.png
index 13f4b6c..830ec41 100644
--- a/res/mipmap-xxhdpi/ic_launcher_calculator.png
+++ b/res/mipmap-xxhdpi/ic_launcher_calculator.png
Binary files differ
diff --git a/res/mipmap-xxxhdpi/ic_launcher_calculator.png b/res/mipmap-xxxhdpi/ic_launcher_calculator.png
index 8594b24..497f27e 100644
--- a/res/mipmap-xxxhdpi/ic_launcher_calculator.png
+++ b/res/mipmap-xxxhdpi/ic_launcher_calculator.png
Binary files differ
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 4ce92ef..6c53e1c 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -74,7 +74,7 @@
<item msgid="3487936384379753697">"plus"</item>
<item msgid="8608534484562258856">"mínus"</item>
<item msgid="3456824579675198186">" bod "</item>
- <item msgid="4528629783180278651">"mocnina"</item>
+ <item msgid="4528629783180278651">"síla"</item>
<item msgid="4050948027333760159">"tangens"</item>
<item msgid="8716478860618683850">"sinus"</item>
<item msgid="3203211483560707480">"kosinus"</item>
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index 8676d59..2585898 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -18,7 +18,7 @@
<dimen name="btn_operation_text_size">50sp</dimen>
<dimen name="btn_function_text_size">25sp</dimen>
<dimen name="btn_clear_text_size">40sp</dimen>
- <dimen name="display_text_size">60sp</dimen>
+ <dimen name="display_text_size">72sp</dimen>
<dimen name="left_right_padding">16sp</dimen>
<dimen name="top_bottom_padding">16sp</dimen>
@@ -30,7 +30,7 @@
<item name="android:gravity">right|bottom</item>
<item name="android:layout_gravity">right|bottom</item>
<item name="android:textColor">#ffffff</item>
- <item name="android:maxLines">1</item>
+ <item name="android:maxLines">2</item>
<item name="android:scrollbars">none</item>
<item name="android:scrollHorizontally">true</item>
<item name="android:layout_width">match_parent</item>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 54171e9..3eaf995 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -16,5 +16,24 @@
<resources>
<color name="magic_flame">#00ffffff</color>
- <color name="button_text">#ffffffff</color>
+
+ <color name="accent">#18FFFF</color>
+
+ <color name="primary_light">#B3E5FC</color>
+ <color name="primary">#03A9F4</color>
+ <color name="primary_dark">#0288D1</color>
+
+ <color name="gray_80">#CCCCCC</color>
+ <color name="gray_70">#B3B3B3</color>
+ <color name="gray_60">#999999</color>
+ <color name="gray_50">#808080</color>
+ <color name="gray_40">#666666</color>
+ <color name="gray_30">#4D4D4D</color>
+ <color name="gray_20">#333333</color>
+
+ <color name="white">#FFFFFF</color>
+ <color name="black">#000000</color>
+
+ <color name="text_light">#B3FFFFFF</color>
+ <color name="text_dark">#B3000000</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
new file mode 100644
index 0000000..3e7f659
--- /dev/null
+++ b/res/values/dimens.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <dimen name="btn_digit_text_size">40sp</dimen>
+ <dimen name="btn_operation_text_size">40sp</dimen>
+ <dimen name="btn_function_text_size">30sp</dimen>
+ <dimen name="btn_clear_text_size">30sp</dimen>
+ <dimen name="small_text_size">16dp</dimen>
+ <dimen name="display_text_size">72sp</dimen>
+ <dimen name="pager_shadow_width">16dp</dimen>
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a24cd4e..5fdb725 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!--
+ Copyright (C) 2007 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,8 +16,9 @@
-->
<resources>
+
<!-- Application name -->
- <string name="app_name">Calculator</string>
+ <string name="app_name">Quantum Calculator</string>
<!-- If there is a syntax error in the user entered calculation, an error dialog will appear. This is the title. -->
<string name="error">Error</string>
<!-- Displayed numbers for the digit buttons -->
@@ -40,7 +42,7 @@
<!-- Displayed numbers for the digit buttons -->
<string name="digit9">9</string>
<!-- Button name on screen to delete the last entered digit or operator -->
- <string name="del">DELETE</string>
+ <string name="del">DEL</string>
<!-- Button name on screen to clear the entire calculation field. [CHAR LIMIT=6] -->
<string name="clear">CLR</string>
<!-- Do not translate. Unicode division sign; don't translate. Displayed as button on screen. -->
@@ -59,30 +61,30 @@
<string name="enter">\u2193</string>
<!-- Displayed on buttons on screen for the sin function. -->
<string name="sin">sin</string>
- <!-- Do not translate. What we replace translated SIN with for calculating sin.-->
- <string translate="false" name="sin_mathematical_value">sin</string>
+ <!-- Do not translate. What we replace translated SIN with for calculating sin. -->
+ <string name="sin_mathematical_value" translate="false">sin</string>
<!-- Displayed on buttons on screen for the cos function. -->
<string name="cos">cos</string>
<!-- Do not translate. What we replace translated COS with for calculating cos. -->
- <string translate="false" name="cos_mathematical_value">cos</string>
+ <string name="cos_mathematical_value" translate="false">cos</string>
<!-- Displayed on buttons on screen for the tan function. -->
<string name="tan">tan</string>
<!-- Do not translate. What we replace translated TAN with for calculating tan. -->
- <string translate="false" name="tan_mathematical_value">tan</string>
+ <string name="tan_mathematical_value" translate="false">tan</string>
<!-- Do not translate. Unicode pi sign; don't translate. Displayed as button on screen. -->
<string name="pi">\u03c0</string>
<!-- Displayed on buttons on screen for the e function. -->
<string name="e">e</string>
<!-- Do not translate. What we replace translated e with for calculating e. -->
- <string translate="false" name="e_mathematical_value">e</string>
+ <string name="e_mathematical_value" translate="false">e</string>
<!-- Displayed on buttons on screen for the ln function. -->
<string name="ln">ln</string>
<!-- Do not translate. What we replace translated ln with for calculating ln. -->
- <string translate="false" name="ln_mathematical_value">ln</string>
+ <string name="ln_mathematical_value" translate="false">ln</string>
<!-- Displayed on buttons on screen for the log function. -->
<string name="lg">log</string>
<!-- Do not translate. What we replace translated lg with for calculating lg. -->
- <string translate="false" name="lg_mathematical_value">lg</string>
+ <string name="lg_mathematical_value" translate="false">lg</string>
<!-- Displayed on buttons on screen for a left parenthesis. -->
<string name="leftParen">(</string>
<!-- Displayed on buttons on screen for a right parenthesis. -->
@@ -102,9 +104,11 @@
<!-- Toast shown when text is copied to the clipboard. -->
<string name="text_copied_toast">Text copied.</string>
- <!--Content descriptions for accessibility. These strings will be read aloud to users who are using the calculator with
+ <!--
+ Content descriptions for accessibility. These strings will be read aloud to users who are using the calculator with
accessibility features enabled and should reflect the mathematical concept instead of a direct representation of what is shown
- on the button-->
+ on the button
+ -->
<string name="leftParenDesc">left parenthesis</string>
<string name="rightParenDesc">right parenthesis</string>
<string name="factorialDesc">factorial</string>
@@ -126,9 +130,11 @@
<string name="piDesc">pi</string>
<string name="equalDesc">equals</string>
- <!--Content descriptions for accessibility used as keys when determining which mathematical
+ <!--
+ Content descriptions for accessibility used as keys when determining which mathematical
concept description to speak when accessibility features are enabled. Order of the array is
- important. -->
+ important.
+ -->
<string-array name="operators" translatable="false">
<item>(</item>
<item>)</item>
@@ -149,44 +155,48 @@
<item>=</item>
</string-array>
- <!--Content descriptions for accessibility. These strings will be read aloud to users who
+ <!--
+ Content descriptions for accessibility. These strings will be read aloud to users who
are using the calculator with accessibility features enabled and hover over the edit text
field. These should reflect the mathematical concept instead of a direct representation of
- what is shown in the text field. Order of the array is important.-->
+ what is shown in the text field. Order of the array is important.
+ -->
<string-array name="operatorDescs">
- <!-- Description for mathematical ( [CHAR LIMIT=200]-->
+
+ <!-- Description for mathematical ( [CHAR LIMIT=200] -->
<item>left parenthesis</item>
- <!-- Description for mathematical ) [CHAR LIMIT=200]-->
+ <!-- Description for mathematical ) [CHAR LIMIT=200] -->
<item>right parenthesis</item>
- <!-- Description for mathematical ! (factorial) function [CHAR LIMIT=200]-->
+ <!-- Description for mathematical ! (factorial) function [CHAR LIMIT=200] -->
<item>factorial</item>
- <!-- Description for mathematical ln [CHAR LIMIT=200]-->
+ <!-- Description for mathematical ln [CHAR LIMIT=200] -->
<item>natural logarithm</item>
- <!-- Description for mathematical log [CHAR LIMIT=200]-->
+ <!-- Description for mathematical log [CHAR LIMIT=200] -->
<item>logarithm</item>
- <!-- Description for mathematical square root [CHAR LIMIT=200]-->
+ <!-- Description for mathematical square root [CHAR LIMIT=200] -->
<item>square root</item>
- <!-- Description for mathematical / [CHAR LIMIT=200]-->
+ <!-- Description for mathematical / [CHAR LIMIT=200] -->
<item>divided by</item>
- <!-- Description for mathematical x [CHAR LIMIT=200]-->
+ <!-- Description for mathematical x [CHAR LIMIT=200] -->
<item>multiplied by</item>
- <!-- Description for mathematical + [CHAR LIMIT=200]-->
+ <!-- Description for mathematical + [CHAR LIMIT=200] -->
<item>plus</item>
- <!-- Description for mathematical - [CHAR LIMIT=200]-->
+ <!-- Description for mathematical - [CHAR LIMIT=200] -->
<item>minus</item>
- <!-- Description for mathematical . [CHAR LIMIT=200]-->
+ <!-- Description for mathematical . [CHAR LIMIT=200] -->
<item>&#160;point&#160;</item>
- <!-- Description for mathematical ^ [CHAR LIMIT=200]-->
+ <!-- Description for mathematical ^ [CHAR LIMIT=200] -->
<item>power</item>
- <!-- Description for mathematical TAN [CHAR LIMIT=200]-->
+ <!-- Description for mathematical TAN [CHAR LIMIT=200] -->
<item>tangent</item>
- <!-- Description for mathematical SIN [CHAR LIMIT=200]-->
+ <!-- Description for mathematical SIN [CHAR LIMIT=200] -->
<item>sine</item>
- <!-- Description for mathematical COS [CHAR LIMIT=200]-->
+ <!-- Description for mathematical COS [CHAR LIMIT=200] -->
<item>cosine</item>
- <!-- Description for mathematical PI [CHAR LIMIT=200]-->
+ <!-- Description for mathematical PI [CHAR LIMIT=200] -->
<item>pi</item>
- <!-- Description for mathematical = [CHAR LIMIT=200]-->
+ <!-- Description for mathematical = [CHAR LIMIT=200] -->
<item>equals</item>
</string-array>
+
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 4680f31..3011d8c 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
+<!--
+ Copyright (C) 2007 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,82 +14,112 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<resources>
- <dimen name="btn_digit_text_size">40sp</dimen>
- <dimen name="btn_operation_text_size">40sp</dimen>
- <dimen name="btn_function_text_size">30sp</dimen>
- <dimen name="btn_clear_text_size">30sp</dimen>
- <dimen name="display_text_size">30sp</dimen>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="button_style">
- <item name="android:textSize">40dp</item>
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:layout_weight">1</item>
- <item name="android:focusable">true</item>
- <item name="android:background">@drawable/btn_function</item>
- <item name="android:layout_marginLeft">1dp</item>
+ <item name="android:textSize">24dp</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">match_parent</item>
+ <item name="android:layout_weight">1</item>
+ <item name="android:focusable">true</item>
+ <item name="android:onClick">onClick</item>
</style>
- <style name="digit_button_style" parent="button_style">
- <item name="android:background">@drawable/btn_digit</item>
+ <style name="stationary_button" parent="button_style">
+ <item name="android:background">@drawable/btn_stationary</item>
+ <item name="android:textColor">@color/text_dark</item>
+ </style>
+
+ <style name="function_pad">
+ <item name="android:background">@color/gray_40</item>
</style>
- <style name="button_small_style" parent="button_style">
- <item name="android:textSize">30dp</item>
+ <style name="function_button" parent="button_style">
+ <item name="android:background">@drawable/btn_digit</item>
+ <item name="android:textColor">@color/text_light</item>
</style>
- <style name="display_style">
- <item name="android:textSize">@dimen/display_text_size</item>
- <item name="android:inputType">text|textNoSuggestions</item>
- <item name="android:gravity">right|center_vertical</item>
- <item name="android:textColor">#ffffff</item>
- <item name="android:maxLines">1</item>
- <item name="android:scrollbars">none</item>
- <item name="android:scrollHorizontally">true</item>
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:paddingTop">8dp</item>
- <item name="android:paddingLeft">8dp</item>
- <item name="android:paddingRight">8dp</item>
- <item name="android:paddingBottom">0dp</item>
+ <!-- Function button used on sw600 devices. -->
+ <style name="function_button_sw600" parent="function_button">
+ <item name="android:layout_width">0dip</item>
+ <item name="android:layout_weight">1</item>
+ </style>
+
+ <style name="digit_pad">
+ <item name="android:background">@color/gray_30</item>
</style>
- <style name="btn_row_style">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">0dip</item>
- <item name="android:layout_weight">1</item>
- <item name="android:orientation">horizontal</item>
+ <style name="digit_button" parent="button_style">
+ <item name="android:background">@drawable/btn_digit</item>
+ <item name="android:textColor">@color/text_light</item>
</style>
- <style name="btn_function_cell_style">
- <item name="android:layout_width">0dip</item>
- <item name="android:layout_weight">1</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:background">@drawable/btn_function</item>
- <item name="android:textSize">@dimen/btn_function_text_size</item>
+ <!-- Digit button used on sw600 devices. -->
+ <style name="digit_button_sw600" parent="digit_button">
+ <item name="android:layout_width">0dip</item>
+ <item name="android:layout_weight">1</item>
+ </style>
+
+ <style name="advanced_pad">
+ <item name="android:background">@color/primary</item>
</style>
- <style name="btn_operation_cell_style">
- <item name="android:layout_width">0dip</item>
- <item name="android:layout_weight">1</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:gravity">center</item>
- <item name="android:background">@drawable/btn_function</item>
- <item name="android:textSize">@dimen/btn_operation_text_size</item>
+ <style name="advanced_button" parent="button_style">
+ <item name="android:background">@drawable/btn_advanced</item>
+ <item name="android:textColor">@color/text_light</item>
</style>
- <style name="btn_digit_cell_style">
- <item name="android:layout_width">0dip</item>
- <item name="android:layout_weight">1</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:gravity">center</item>
- <item name="android:background">@drawable/btn_digit</item>
- <item name="android:textSize">@dimen/btn_digit_text_size</item>
+ <!-- Advanced button used on sw600 devices. -->
+ <style name="advanced_button_s600" parent="advanced_button">
+ <item name="android:layout_width">0dip</item>
+ <item name="android:layout_weight">1</item>
+ </style>
+
+ <style name="advanced_button_small" parent="advanced_button">
+ <item name="android:textSize">30dp</item>
+ </style>
+
+ <style name="button_small_style" parent="button_style">
+ <item name="android:textSize">30dp</item>
+ </style>
+
+ <!-- Style applied to a display card. -->
+ <style name="display_style">
+ <item name="android:textSize">@dimen/display_text_size</item>
+ <item name="android:inputType">text|textNoSuggestions</item>
+ <item name="android:gravity">right|center_vertical</item>
+ <item name="android:textColor">@color/text_dark</item>
+ <item name="android:maxLines">1</item>
+ <item name="android:scrollbars">none</item>
+ <item name="android:scrollHorizontally">true</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">match_parent</item>
+ <item name="android:paddingTop">16dp</item>
+ <item name="android:paddingLeft">8dp</item>
+ <item name="android:paddingRight">8dp</item>
+ <item name="android:paddingBottom">16dp</item>
+ <item name="android:background">@drawable/card_background</item>
+ <item name="android:layout_margin">8sp</item>
+ </style>
+
+ <!-- Style applied to the display card container. -->
+ <style name="display_holder_style">
+ <item name="android:background">@color/gray_80</item>
+ </style>
+
+ <!-- Style used in sw600dp single-screen mode. -->
+ <style name="btn_row_style">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">0dip</item>
+ <item name="android:layout_weight">1</item>
+ <item name="android:orientation">horizontal</item>
</style>
<style name="btn_clear">
- <item name="android:background">?android:attr/selectableItemBackground</item>
- <item name="android:textSize">@dimen/btn_clear_text_size</item>
+ <item name="android:background">?android:attr/selectableItemBackground</item>
+ <item name="android:textSize">@dimen/btn_clear_text_size</item>
</style>
+
+ <style name="AppTheme" parent="@android:style/Theme.Quantum" />
+
</resources> \ No newline at end of file
diff --git a/src/com/android/calculator2/Calculator.java b/src/com/android/calculator2/Calculator.java
index d7b7742..d8e53de 100644
--- a/src/com/android/calculator2/Calculator.java
+++ b/src/com/android/calculator2/Calculator.java
@@ -17,36 +17,28 @@
package com.android.calculator2;
import android.app.Activity;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
-import android.view.KeyEvent;
import android.view.LayoutInflater;
-import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.WindowManager;
-import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
+import com.android.calculator2.R;
+
public class Calculator extends Activity implements PanelSwitcher.Listener, Logic.Listener,
- OnClickListener, OnMenuItemClickListener {
+ OnMenuItemClickListener, View.OnClickListener {
EventListener mListener = new EventListener();
private CalculatorDisplay mDisplay;
private Persist mPersist;
private History mHistory;
private Logic mLogic;
private ViewPager mPager;
- private View mClearButton;
- private View mBackspaceButton;
- private View mOverflowMenuButton;
static final int BASIC_PANEL = 0;
static final int ADVANCED_PANEL = 1;
@@ -68,24 +60,6 @@ public class Calculator extends Activity implements PanelSwitcher.Listener, Logi
mPager = (ViewPager) findViewById(R.id.panelswitch);
if (mPager != null) {
mPager.setAdapter(new PageAdapter(mPager));
- } else {
- // Single page UI
- final TypedArray buttons = getResources().obtainTypedArray(R.array.buttons);
- for (int i = 0; i < buttons.length(); i++) {
- setOnClickListener(null, buttons.getResourceId(i, 0));
- }
- buttons.recycle();
- }
-
- if (mClearButton == null) {
- mClearButton = findViewById(R.id.clear);
- mClearButton.setOnClickListener(mListener);
- mClearButton.setOnLongClickListener(mListener);
- }
- if (mBackspaceButton == null) {
- mBackspaceButton = findViewById(R.id.del);
- mBackspaceButton.setOnClickListener(mListener);
- mBackspaceButton.setOnLongClickListener(mListener);
}
mPersist = new Persist(this);
@@ -111,110 +85,17 @@ public class Calculator extends Activity implements PanelSwitcher.Listener, Logi
mListener.setHandler(mLogic, mPager);
mDisplay.setOnKeyListener(mListener);
- if (!ViewConfiguration.get(this).hasPermanentMenuKey()) {
- createFakeMenu();
- }
-
mLogic.resumeWithHistory();
- updateDeleteMode();
- }
-
- private void updateDeleteMode() {
- if (mLogic.getDeleteMode() == Logic.DELETE_MODE_BACKSPACE) {
- mClearButton.setVisibility(View.GONE);
- mBackspaceButton.setVisibility(View.VISIBLE);
- } else {
- mClearButton.setVisibility(View.VISIBLE);
- mBackspaceButton.setVisibility(View.GONE);
- }
- }
-
- void setOnClickListener(View root, int id) {
- final View target = root != null ? root.findViewById(id) : findViewById(id);
- target.setOnClickListener(mListener);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- getMenuInflater().inflate(R.menu.menu, menu);
- return true;
- }
-
- @Override
- public boolean onPrepareOptionsMenu(Menu menu) {
- super.onPrepareOptionsMenu(menu);
- menu.findItem(R.id.basic).setVisible(!getBasicVisibility());
- menu.findItem(R.id.advanced).setVisible(!getAdvancedVisibility());
- return true;
- }
-
-
- private void createFakeMenu() {
- mOverflowMenuButton = findViewById(R.id.overflow_menu);
- if (mOverflowMenuButton != null) {
- mOverflowMenuButton.setVisibility(View.VISIBLE);
- mOverflowMenuButton.setOnClickListener(this);
- }
- }
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.overflow_menu:
- PopupMenu menu = constructPopupMenu();
- if (menu != null) {
- menu.show();
- }
- break;
- }
- }
-
- private PopupMenu constructPopupMenu() {
- final PopupMenu popupMenu = new PopupMenu(this, mOverflowMenuButton);
- mOverflowMenuButton.setOnTouchListener(popupMenu.getDragToOpenListener());
- final Menu menu = popupMenu.getMenu();
- popupMenu.inflate(R.menu.menu);
- popupMenu.setOnMenuItemClickListener(this);
- onPrepareOptionsMenu(menu);
- return popupMenu;
}
-
@Override
public boolean onMenuItemClick(MenuItem item) {
return onOptionsItemSelected(item);
}
- private boolean getBasicVisibility() {
- return mPager != null && mPager.getCurrentItem() == BASIC_PANEL;
- }
-
- private boolean getAdvancedVisibility() {
- return mPager != null && mPager.getCurrentItem() == ADVANCED_PANEL;
- }
-
@Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.clear_history:
- mHistory.clear();
- mLogic.onClear();
- break;
-
- case R.id.basic:
- if (!getBasicVisibility() && mPager != null) {
- mPager.setCurrentItem(BASIC_PANEL, true);
- }
- break;
-
- case R.id.advanced:
- if (!getAdvancedVisibility() && mPager != null) {
- mPager.setCurrentItem(ADVANCED_PANEL, true);
- }
- break;
- }
- return super.onOptionsItemSelected(item);
+ public void onClick(View v) {
+ mListener.onClick(v);
}
@Override
@@ -234,14 +115,8 @@ public class Calculator extends Activity implements PanelSwitcher.Listener, Logi
}
@Override
- public boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
- if (keyCode == KeyEvent.KEYCODE_BACK && getAdvancedVisibility()
- && mPager != null) {
- mPager.setCurrentItem(BASIC_PANEL);
- return true;
- } else {
- return super.onKeyDown(keyCode, keyEvent);
- }
+ public void onDeleteModeChange() {
+ // Meh?
}
static void log(String message) {
@@ -255,44 +130,14 @@ public class Calculator extends Activity implements PanelSwitcher.Listener, Logi
invalidateOptionsMenu();
}
- @Override
- public void onDeleteModeChange() {
- updateDeleteMode();
- }
-
- class PageAdapter extends PagerAdapter {
+ static class PageAdapter extends PagerAdapter {
private View mSimplePage;
private View mAdvancedPage;
public PageAdapter(ViewPager parent) {
final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
- final View simplePage = inflater.inflate(R.layout.simple_pad, parent, false);
- final View advancedPage = inflater.inflate(R.layout.advanced_pad, parent, false);
- mSimplePage = simplePage;
- mAdvancedPage = advancedPage;
-
- final Resources res = getResources();
- final TypedArray simpleButtons = res.obtainTypedArray(R.array.simple_buttons);
- for (int i = 0; i < simpleButtons.length(); i++) {
- setOnClickListener(simplePage, simpleButtons.getResourceId(i, 0));
- }
- simpleButtons.recycle();
-
- final TypedArray advancedButtons = res.obtainTypedArray(R.array.advanced_buttons);
- for (int i = 0; i < advancedButtons.length(); i++) {
- setOnClickListener(advancedPage, advancedButtons.getResourceId(i, 0));
- }
- advancedButtons.recycle();
-
- final View clearButton = simplePage.findViewById(R.id.clear);
- if (clearButton != null) {
- mClearButton = clearButton;
- }
-
- final View backspaceButton = simplePage.findViewById(R.id.del);
- if (backspaceButton != null) {
- mBackspaceButton = backspaceButton;
- }
+ mSimplePage = inflater.inflate(R.layout.simple_pad, parent, false);
+ mAdvancedPage = inflater.inflate(R.layout.advanced_pad, parent, false);
}
@Override
@@ -301,23 +146,20 @@ public class Calculator extends Activity implements PanelSwitcher.Listener, Logi
}
@Override
- public void startUpdate(View container) {
+ public float getPageWidth(int position) {
+ return 0.90f;
}
@Override
- public Object instantiateItem(View container, int position) {
+ public Object instantiateItem(ViewGroup container, int position) {
final View page = position == 0 ? mSimplePage : mAdvancedPage;
- ((ViewGroup) container).addView(page);
+ container.addView(page);
return page;
}
@Override
- public void destroyItem(View container, int position, Object object) {
- ((ViewGroup) container).removeView((View) object);
- }
-
- @Override
- public void finishUpdate(View container) {
+ public void destroyItem(ViewGroup container, int position, Object object) {
+ container.removeView((View) object);
}
@Override
diff --git a/src/com/android/calculator2/CalculatorDisplay.java b/src/com/android/calculator2/CalculatorDisplay.java
index 3a19143..ec4070e 100644
--- a/src/com/android/calculator2/CalculatorDisplay.java
+++ b/src/com/android/calculator2/CalculatorDisplay.java
@@ -50,9 +50,16 @@ class CalculatorDisplay extends ViewSwitcher {
private int mMaxDigits = DEFAULT_MAX_DIGITS;
+ public CalculatorDisplay(Context context) {
+ this(context, null);
+ }
+
public CalculatorDisplay(Context context, AttributeSet attrs) {
super(context, attrs);
- mMaxDigits = attrs.getAttributeIntValue(null, ATTR_MAX_DIGITS, DEFAULT_MAX_DIGITS);
+
+ if (attrs != null) {
+ mMaxDigits = attrs.getAttributeIntValue(null, ATTR_MAX_DIGITS, DEFAULT_MAX_DIGITS);
+ }
}
public int getMaxDigits() {
@@ -62,6 +69,7 @@ class CalculatorDisplay extends ViewSwitcher {
protected void setLogic(Logic logic) {
NumberKeyListener calculatorKeyListener =
new NumberKeyListener() {
+ @Override
public int getInputType() {
return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
@@ -84,7 +92,6 @@ class CalculatorDisplay extends ViewSwitcher {
Editable.Factory factory = new CalculatorEditable.Factory(logic);
for (int i = 0; i < 2; ++i) {
EditText text = (EditText) getChildAt(i);
- text.setBackground(null);
text.setEditableFactory(factory);
text.setKeyListener(calculatorKeyListener);
text.setSingleLine();
@@ -116,6 +123,11 @@ class CalculatorDisplay extends ViewSwitcher {
editor.getText().insert(cursor, delta);
}
+ void append(String delta) {
+ EditText editor = (EditText) getCurrentView();
+ editor.getText().append(delta);
+ }
+
EditText getEditText() {
return (EditText) getCurrentView();
}
diff --git a/src/com/android/calculator2/CalculatorEditText.java b/src/com/android/calculator2/CalculatorEditText.java
index 2135b38..4facf13 100644
--- a/src/com/android/calculator2/CalculatorEditText.java
+++ b/src/com/android/calculator2/CalculatorEditText.java
@@ -16,6 +16,8 @@
package com.android.calculator2;
+import com.google.common.collect.ImmutableMap;
+
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
@@ -35,7 +37,7 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.EditText;
import android.widget.Toast;
-import com.google.common.collect.ImmutableMap;
+import com.android.calculator2.R;
public class CalculatorEditText extends EditText {
@@ -47,10 +49,15 @@ public class CalculatorEditText extends EditText {
private ImmutableMap<String, String> sReplacementTable;
private String[] sOperators;
+ public CalculatorEditText(Context context) {
+ this(context, null);
+ }
+
public CalculatorEditText(Context context, AttributeSet attrs) {
super(context, attrs);
setCustomSelectionActionModeCallback(new NoTextSelectionMode());
setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
+ setCursorVisible(false);
}
@Override
diff --git a/src/com/android/calculator2/CalculatorViewPager.java b/src/com/android/calculator2/CalculatorViewPager.java
index 880fcc8..25e9575 100644
--- a/src/com/android/calculator2/CalculatorViewPager.java
+++ b/src/com/android/calculator2/CalculatorViewPager.java
@@ -17,24 +17,66 @@
package com.android.calculator2;
import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
+import android.view.View;
+
+import com.android.calculator2.R;
public class CalculatorViewPager extends ViewPager {
- public CalculatorViewPager(Context context) {
- super(context);
- }
+ private Drawable mShadowRight;
+ private int mShadowWidth;
public CalculatorViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
+
+ setPageTransformer(false, mTransformer);
+
+ final Resources res = context.getResources();
+ mShadowRight = res.getDrawable(R.drawable.shadow_right);
+ mShadowWidth = res.getDimensionPixelSize(R.dimen.pager_shadow_width);
}
/**
- * ViewPager inherits ViewGroup's default behavior of delayed clicks
- * on its children, but in order to make the calc buttons more responsive
- * we disable that here.
+ * ViewPager inherits ViewGroup's default behavior of delayed clicks on its
+ * children, but in order to make the calc buttons more responsive we
+ * disable that here.
*/
+ @Override
public boolean shouldDelayChildPressedState() {
return false;
}
+
+ @Override
+ protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
+ final boolean result = super.drawChild(canvas, child, drawingTime);
+ mShadowRight.setBounds(child.getLeft() - mShadowWidth, child.getTop(), child.getLeft(),
+ child.getBottom());
+ mShadowRight.draw(canvas);
+ return result;
+ }
+
+ private final PageTransformer mTransformer = new PageTransformer() {
+ @Override
+ public void transformPage(View v, float position) {
+ final int pageWidth = v.getWidth();
+
+ if (position < -1) {
+ v.setAlpha(0);
+ } else if (position <= 0) {
+ // Pin the left page to the left side.
+ v.setTranslationX(pageWidth * -position);
+ } else if (position <= 1) {
+ // Use the default slide transition when moving to the right
+ // page
+ v.setAlpha(1);
+ v.setTranslationX(0);
+ } else {
+ v.setAlpha(0);
+ }
+ }
+ };
}
diff --git a/src/com/android/calculator2/ColorButton.java b/src/com/android/calculator2/ColorButton.java
deleted file mode 100644
index 7526e85..0000000
--- a/src/com/android/calculator2/ColorButton.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.calculator2;
-
-import android.content.Context;
-import android.graphics.Paint;
-import android.util.AttributeSet;
-import android.view.View.OnClickListener;
-import android.view.View;
-import android.widget.Button;
-
-/**
- * Button with click-animation effect.
- */
-class ColorButton extends Button implements OnClickListener {
- int CLICK_FEEDBACK_COLOR;
- static final int CLICK_FEEDBACK_INTERVAL = 10;
- static final int CLICK_FEEDBACK_DURATION = 350;
-
- float mTextX;
- float mTextY;
- long mAnimStart;
- OnClickListener mListener;
-
- public ColorButton(Context context, AttributeSet attrs) {
- super(context, attrs);
- Calculator calc = (Calculator) context;
- mListener = calc.mListener;
- setOnClickListener(this);
- }
-
- public void onClick(View view) {
- mListener.onClick(this);
- }
-
- @Override
- public void onSizeChanged(int w, int h, int oldW, int oldH) {
- measureText();
- }
-
- private void measureText() {
- Paint paint = getPaint();
- mTextX = (getWidth() - paint.measureText(getText().toString())) / 2;
- mTextY = (getHeight() - paint.ascent() - paint.descent()) / 2;
- }
-
- @Override
- protected void onTextChanged(CharSequence text, int start, int before, int after) {
- measureText();
- }
-}
diff --git a/src/com/android/calculator2/EventListener.java b/src/com/android/calculator2/EventListener.java
index 1d6f5d5..cc45215 100644
--- a/src/com/android/calculator2/EventListener.java
+++ b/src/com/android/calculator2/EventListener.java
@@ -21,6 +21,8 @@ import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
+import com.android.calculator2.R;
+
class EventListener implements View.OnKeyListener,
View.OnClickListener,
View.OnLongClickListener {
@@ -55,10 +57,7 @@ class EventListener implements View.OnKeyListener,
// add paren after sin, cos, ln, etc. from buttons
text += '(';
}
- mHandler.insert(text);
- if (mPager != null && mPager.getCurrentItem() == Calculator.ADVANCED_PANEL) {
- mPager.setCurrentItem(Calculator.BASIC_PANEL);
- }
+ mHandler.append(text);
}
}
}
diff --git a/src/com/android/calculator2/HistoryAdapter.java b/src/com/android/calculator2/HistoryAdapter.java
index 02ceeee..6587a27 100644
--- a/src/com/android/calculator2/HistoryAdapter.java
+++ b/src/com/android/calculator2/HistoryAdapter.java
@@ -16,17 +16,19 @@
package com.android.calculator2;
+import android.content.Context;
import android.view.LayoutInflater;
-import android.view.ViewGroup;
import android.view.View;
-import android.content.Context;
+import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
-import java.util.Vector;
+import com.android.calculator2.R;
import org.javia.arity.SyntaxException;
+import java.util.Vector;
+
class HistoryAdapter extends BaseAdapter {
private Vector<HistoryEntry> mEntries;
private LayoutInflater mInflater;
diff --git a/src/com/android/calculator2/Logic.java b/src/com/android/calculator2/Logic.java
index 83db577..0deea04 100644
--- a/src/com/android/calculator2/Logic.java
+++ b/src/com/android/calculator2/Logic.java
@@ -16,22 +16,23 @@
package com.android.calculator2;
-import com.android.calculator2.CalculatorDisplay.Scroll;
-
+import android.content.Context;
+import android.content.res.Resources;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.widget.EditText;
-import android.content.Context;
-import android.content.res.Resources;
+
+import com.android.calculator2.R;
+import com.android.calculator2.CalculatorDisplay.Scroll;
+
+import org.javia.arity.Symbols;
+import org.javia.arity.SyntaxException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map.Entry;
import java.util.Set;
-import org.javia.arity.Symbols;
-import org.javia.arity.SyntaxException;
-
class Logic {
private CalculatorDisplay mDisplay;
private Symbols mSymbols = new Symbols();
@@ -108,6 +109,11 @@ class Logic {
setDeleteMode(DELETE_MODE_BACKSPACE);
}
+ void append(String delta) {
+ mDisplay.append(delta);
+ setDeleteMode(DELETE_MODE_BACKSPACE);
+ }
+
public void onTextChanged() {
setDeleteMode(DELETE_MODE_BACKSPACE);
}
diff --git a/src/com/android/calculator2/SquareLinearLayout.java b/src/com/android/calculator2/SquareLinearLayout.java
new file mode 100644
index 0000000..eba5edf
--- /dev/null
+++ b/src/com/android/calculator2/SquareLinearLayout.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.calculator2;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.LinearLayout;
+
+public class SquareLinearLayout extends LinearLayout {
+ public SquareLinearLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
+ final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
+ final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
+ final int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+
+ final int size;
+ if (widthMode == MeasureSpec.EXACTLY && widthSize > 0) {
+ size = widthSize;
+ } else if (heightMode == MeasureSpec.EXACTLY && heightSize > 0) {
+ size = heightSize;
+ } else {
+ size = widthSize < heightSize ? widthSize : heightSize;
+ }
+
+ final int finalMeasureSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY);
+ super.onMeasure(finalMeasureSpec, finalMeasureSpec);
+ }
+}