am ef027e27: (-s ours) Import revised translations.  DO NOT MERGE

Merge commit 'ef027e278ceb3c44e72253802750c6b975dfc827' into eclair

* commit 'ef027e278ceb3c44e72253802750c6b975dfc827':
  Import revised translations.  DO NOT MERGE
diff --git a/Android.mk b/Android.mk
index 2379a94..b34c467 100644
--- a/Android.mk
+++ b/Android.mk
@@ -27,7 +27,7 @@
 ##################################################
 include $(CLEAR_VARS)
 
-LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libarity:arity-1.3.1.jar
+LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libarity:arity-1.3.3.jar
 include $(BUILD_MULTI_PREBUILT)
 
 # Use the folloing include to make our test apk.
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ce9063f..fd5e95d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3,7 +3,7 @@
     package="com.android.calculator2">
     <application android:label="@string/app_name" android:icon="@drawable/icon">
         <activity android:name="Calculator" 
-                  android:theme="@android:style/Theme.Black">
+                  android:theme="@android:style/Theme.Black.NoTitleBar">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
diff --git a/arity-1.3.1.jar b/arity-1.3.1.jar
deleted file mode 100644
index ceab57a..0000000
--- a/arity-1.3.1.jar
+++ /dev/null
Binary files differ
diff --git a/arity-1.3.3.jar b/arity-1.3.3.jar
new file mode 100644
index 0000000..c7d9154
--- /dev/null
+++ b/arity-1.3.3.jar
Binary files differ
diff --git a/res/drawable-hdpi/advanced.png b/res/drawable-hdpi/advanced.png
new file mode 100644
index 0000000..84bfcbb
--- /dev/null
+++ b/res/drawable-hdpi/advanced.png
Binary files differ
diff --git a/res/drawable-hdpi/clear_history.png b/res/drawable-hdpi/clear_history.png
new file mode 100644
index 0000000..d05aa77
--- /dev/null
+++ b/res/drawable-hdpi/clear_history.png
Binary files differ
diff --git a/res/drawable-hdpi/icon.png b/res/drawable-hdpi/icon.png
new file mode 100644
index 0000000..ac1c045
--- /dev/null
+++ b/res/drawable-hdpi/icon.png
Binary files differ
diff --git a/res/drawable-hdpi/simple.png b/res/drawable-hdpi/simple.png
new file mode 100644
index 0000000..fe477b6
--- /dev/null
+++ b/res/drawable-hdpi/simple.png
Binary files differ
diff --git a/res/drawable/advanced.png b/res/drawable-mdpi/advanced.png
similarity index 100%
rename from res/drawable/advanced.png
rename to res/drawable-mdpi/advanced.png
Binary files differ
diff --git a/res/drawable/clear_history.png b/res/drawable-mdpi/clear_history.png
similarity index 100%
rename from res/drawable/clear_history.png
rename to res/drawable-mdpi/clear_history.png
Binary files differ
diff --git a/res/drawable/icon.png b/res/drawable-mdpi/icon.png
similarity index 100%
rename from res/drawable/icon.png
rename to res/drawable-mdpi/icon.png
Binary files differ
diff --git a/res/drawable/simple.png b/res/drawable-mdpi/simple.png
similarity index 100%
rename from res/drawable/simple.png
rename to res/drawable-mdpi/simple.png
Binary files differ
diff --git a/res/drawable/blue_button.xml b/res/drawable/blue_button.xml
new file mode 100644
index 0000000..f4d6059
--- /dev/null
+++ b/res/drawable/blue_button.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+     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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <gradient android:startColor="#071622" android:endColor="#253541"
+            android:angle="90"/>
+    <corners android:radius="0dp" />
+</shape>
diff --git a/res/drawable/button.png b/res/drawable/button.png
deleted file mode 100644
index f28073c..0000000
--- a/res/drawable/button.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/button.xml b/res/drawable/button.xml
new file mode 100644
index 0000000..e5112ee
--- /dev/null
+++ b/res/drawable/button.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+     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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <gradient android:startColor="#000000" android:endColor="#333333"
+            android:angle="90"/>
+    <corners android:radius="0dp" />
+</shape>
diff --git a/res/drawable/button_bg.png b/res/drawable/button_bg.png
deleted file mode 100644
index 83eeb0f..0000000
--- a/res/drawable/button_bg.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/lcd.9.png b/res/drawable/lcd.9.png
deleted file mode 100644
index 942ede9..0000000
--- a/res/drawable/lcd.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/small_button.9.png b/res/drawable/small_button.9.png
deleted file mode 100644
index c6b60a8..0000000
--- a/res/drawable/small_button.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/small_button_pressed.9.png b/res/drawable/small_button_pressed.9.png
deleted file mode 100644
index 5b5c866..0000000
--- a/res/drawable/small_button_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/small_button_stateful.xml b/res/drawable/small_button_stateful.xml
deleted file mode 100644
index a3326dd..0000000
--- a/res/drawable/small_button_stateful.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_pressed="true" android:drawable="@drawable/small_button_pressed" />
-    <item android:drawable="@drawable/small_button" />
-</selector>
diff --git a/res/layout-land/main.xml b/res/layout-land/main.xml
index c116984..a684d2e 100644
--- a/res/layout-land/main.xml
+++ b/res/layout-land/main.xml
@@ -23,40 +23,42 @@
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:background="#ff000000">
+    <LinearLayout
+         android:layout_width="fill_parent"
+         android:layout_height="0dp"
+         android:layout_weight="2"
+         >
 
-    <RelativeLayout
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="0"
-        android:layout_marginLeft="0px"
-        android:layout_marginRight="0px"
-        android:layout_marginBottom="0px"
-        >
-        
-        <LinearLayout
-             android:layout_width="fill_parent"
-             android:layout_height="wrap_content"
-             android:background="@drawable/lcd" 
-             android:layout_marginRight="0px"
-             >
-            
             <com.android.calculator2.CalculatorDisplay 
                  android:id="@+id/display"
-                 android:layout_width="fill_parent"
-                 android:layout_height="wrap_content"
+                 android:layout_width="0dp"
+                 android:layout_weight="5"
+                 android:layout_height="fill_parent"
                  >
 
                 <EditText style="@style/display_style" />                
                 <EditText style="@style/display_style" />
                 
-            </com.android.calculator2.CalculatorDisplay>                      
-        </LinearLayout>
-    </RelativeLayout>
+            </com.android.calculator2.CalculatorDisplay>
+
+        <com.android.calculator2.ColorButton
+             android:id="@+id/del"
+             android:text="@string/clear"
+             android:layout_width="0dp"
+             android:layout_weight="1"
+             android:layout_height="fill_parent"
+             android:textColor="#ffffffff"
+             android:layout_marginRight="0dp"
+             android:textSize="15dp"
+             style="@style/button_style"
+             />
+    </LinearLayout>
 
     <com.android.calculator2.PanelSwitcher
          android:id="@+id/panelswitch"
          android:layout_width="fill_parent"
-         android:layout_height="fill_parent"
+         android:layout_height="0dp"
+         android:layout_weight="5"
          >
 
     <LinearLayout 
@@ -69,22 +71,22 @@
         <LinearLayout 
              android:layout_weight="1"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >    
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit7"
                 android:text="@string/digit7"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit8"
                 android:text="@string/digit8"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit9"
                 android:text="@string/digit9"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/leftParen"
@@ -106,27 +108,27 @@
         <LinearLayout 
              android:layout_weight="1"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >    
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit4"
                 android:text="@string/digit4"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />        
             <com.android.calculator2.ColorButton 
                 android:id="@+id/digit5"
                 android:text="@string/digit5"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton 
                 android:id="@+id/digit6"
                 android:text="@string/digit6"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton 
                 android:id="@+id/dot"
                 android:text="@string/dot"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/div"
@@ -143,27 +145,27 @@
         <LinearLayout 
              android:layout_weight="1"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >            
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit1"
                 android:text="@string/digit1"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />        
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit2"
                 android:text="@string/digit2"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton 
                 android:id="@+id/digit3"
                 android:text="@string/digit3"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit0"
                 android:text="@string/digit0"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/equal"
@@ -185,14 +187,14 @@
          android:layout_weight="1"
          android:orientation="vertical"
          android:layout_gravity="center"
-         android:layout_marginTop="5px"         
-         android:layout_marginBottom="0px"
+         android:layout_marginTop="5dp"
+         android:layout_marginBottom="0dp"
          > 
         
         <LinearLayout 
             android:layout_weight="1"
             android:layout_width="fill_parent"
-            android:layout_height="0px"
+            android:layout_height="0dp"
             >            
             <com.android.calculator2.ColorButton 
                 android:id="@+id/sin"
@@ -224,7 +226,7 @@
         <LinearLayout 
             android:layout_weight="1"
             android:layout_width="fill_parent"
-            android:layout_height="0px"
+            android:layout_height="0dp"
             >            
             <com.android.calculator2.ColorButton
                 android:id="@+id/ln"
diff --git a/res/layout-port/main.xml b/res/layout-port/main.xml
index b115e53..aa3566c 100644
--- a/res/layout-port/main.xml
+++ b/res/layout-port/main.xml
@@ -24,35 +24,23 @@
               android:layout_height="fill_parent"
               android:background="#ff000000">
 
-    <RelativeLayout
-         android:layout_width="fill_parent"
-         android:layout_height="wrap_content"
-         android:layout_marginTop="5px"
-         >
-
-        <LinearLayout
-              android:layout_width="fill_parent"
-              android:layout_height="wrap_content"
-              android:background="@drawable/lcd"
-              android:layout_marginRight="0px">
-
             <com.android.calculator2.CalculatorDisplay
                  android:id="@+id/display"
                  android:layout_width="fill_parent"
-                 android:layout_height="wrap_content"
+                 android:layout_height="0dp"
+                 android:layout_weight="1"
                  >
 
                 <EditText style="@style/display_style" />
                 <EditText style="@style/display_style" />
 
             </com.android.calculator2.CalculatorDisplay>
-        </LinearLayout>
-    </RelativeLayout>
 
     <com.android.calculator2.PanelSwitcher
          android:id="@+id/panelswitch"
          android:layout_width="fill_parent"
-         android:layout_height="fill_parent"
+         android:layout_height="0dp"
+         android:layout_weight="4"
          >
 
     <LinearLayout
@@ -65,51 +53,48 @@
 
         <LinearLayout
              android:layout_width="fill_parent"
-             android:layout_height="wrap_content"
-             android:layout_marginBottom="8px"
-             android:layout_marginTop="5px"
+             android:layout_height="0dp"
+             android:layout_weight="2"
              >
 
             <View
-                android:layout_width="0px"
-                android:layout_height="0px"
-                android:layout_weight="1"
+                android:background="@drawable/button"
+                android:layout_width="0dp"
+                android:layout_height="fill_parent"
+                android:layout_weight="3"
                 />
                         
             <!-- marginRight has to be 0 to catch border-touch -->
-            <Button
-                 android:background="@drawable/small_button_stateful"
+            <com.android.calculator2.ColorButton
                  android:id="@+id/del"
                  android:text="@string/clear"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:width="90px"
-                 android:height="50px"
-                 android:textColor="#ffffffff"
-                 android:layout_marginRight="0px"
-                 android:layout_marginBottom="3px"
-                 android:layout_weight="0"
+                 android:layout_width="0dp"
+                 android:layout_weight="1"
+                 android:layout_height="fill_parent"
+                 android:layout_marginRight="0dp"
+                 android:textSize="15dp"
+                 style="@style/button_style"
                  />
 	</LinearLayout>
 
         <LinearLayout
-             android:layout_weight="1"
+             android:layout_weight="3"
              android:layout_width="fill_parent"
-             android:layout_height="0px">
+             android:layout_height="0dp">
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit7"
                 android:text="@string/digit7"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit8"
                 android:text="@string/digit8"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit9"
                 android:text="@string/digit9"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/div"
@@ -119,24 +104,24 @@
         </LinearLayout>
 
         <LinearLayout
-             android:layout_weight="1"
+             android:layout_weight="3"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit4"
                 android:text="@string/digit4"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit5"
                 android:text="@string/digit5"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit6"
                 android:text="@string/digit6"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/mul"
@@ -146,24 +131,24 @@
         </LinearLayout>
 
         <LinearLayout
-             android:layout_weight="1"
+             android:layout_weight="3"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit1"
                 android:text="@string/digit1"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit2"
                 android:text="@string/digit2"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit3"
                 android:text="@string/digit3"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/minus"
@@ -173,19 +158,19 @@
         </LinearLayout>
 
         <LinearLayout
-             android:layout_weight="1"
+             android:layout_weight="3"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >
             <com.android.calculator2.ColorButton
                 android:id="@+id/dot"
                 android:text="@string/dot"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/digit0"
                 android:text="@string/digit0"
-                style="@style/button_style"
+                style="@style/digit_button_style"
                 />
             <com.android.calculator2.ColorButton
                 android:id="@+id/equal"
@@ -210,7 +195,7 @@
         <LinearLayout
              android:layout_weight="1"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >
             <com.android.calculator2.ColorButton
                 android:id="@+id/sin"
@@ -232,7 +217,7 @@
         <LinearLayout
              android:layout_weight="1"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >
             <com.android.calculator2.ColorButton
                 android:id="@+id/ln"
@@ -254,7 +239,7 @@
         <LinearLayout
              android:layout_weight="1"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >
             <com.android.calculator2.ColorButton
                 android:id="@+id/pi"
@@ -276,7 +261,7 @@
         <LinearLayout
              android:layout_weight="1"
              android:layout_width="fill_parent"
-             android:layout_height="0px"
+             android:layout_height="0dp"
              >
             <com.android.calculator2.ColorButton
                 android:id="@+id/leftParen"
diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml
new file mode 100755
index 0000000..79616d9
--- /dev/null
+++ b/res/values-uk/strings.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <!-- Application name -->
+    <string name="app_name">Калькулятор</string>
+    <!-- If there is a syntax error in the user entered calculation, an error dialog will appear.  This is the title. -->
+    <string name="error">"Помилка"</string>
+    <!-- Displayed numbers for the digit buttons -->
+    <string name="digit0">0</string>
+    <!-- Displayed numbers for the digit buttons -->
+    <string name="digit1">1</string>
+    <!-- Displayed numbers for the digit buttons -->
+    <string name="digit2">2</string>
+    <!-- Displayed numbers for the digit buttons -->
+    <string name="digit3">3</string>
+    <!-- Displayed numbers for the digit buttons -->
+    <string name="digit4">4</string>
+    <!-- Displayed numbers for the digit buttons -->
+    <string name="digit5">5</string>
+    <!-- Displayed numbers for the digit buttons -->
+    <string name="digit6">6</string>
+    <!-- Displayed numbers for the digit buttons -->
+    <string name="digit7">7</string>
+    <!-- Displayed numbers for the digit buttons -->
+    <string name="digit8">8</string>
+    <!-- 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">"ВИДАЛИТИ"</string>
+    <!-- Button name on screen to clear the entire calculation field -->
+    <string name="clear">"ОЧИСТИТИ"</string>
+    <!-- Do not translate. Unicode division sign; don't translate. Displayed as button on screen. -->
+    <string name="div">\u00f7</string>
+    <!-- Do not translate. Unicode multiplication sign; don't translate. Displayed as button on screen. -->
+    <string name="mul">\u00d7</string>
+    <!-- Do not translate. Plus sign, displayed as button on screen -->
+    <string name="plus">+</string>
+    <!-- Do not translate. Unicode minus sign; don't translate. Displayed as button on screen. -->
+    <string name="minus">\u2212</string>
+    <!-- Do not translate. Decimal point; don't translate. Displayed as button on screen. -->
+    <string name="dot">.</string>
+    <!-- Do not translate. Equal sign; don't translate. Displayed as button on screen. -->
+    <string name="equal">=</string>
+    <!-- Do not translate. Down arrow; don't translate. Displayed as button on screen. -->
+    <string name="enter">\u2193</string>
+    <!-- Displayed on buttons on screen for the sin function. -->
+    <string name="sin">sin</string>
+    <!-- Displayed on buttons on screen for the cos function. -->
+    <string name="cos">cos</string>
+    <!-- Displayed on buttons on screen for the tan function. -->
+    <string name="tan">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>
+    <!-- Displayed on buttons on screen for the ln function. -->
+    <string name="ln">ln</string>
+    <!-- Displayed on buttons on screen for the log function. -->
+    <string name="lg">log</string>
+    <!-- Displayed on buttons on screen for a left parenthesis. -->
+    <string name="leftParen">(</string>
+    <!-- Displayed on buttons on screen for a right parenthesis. -->
+    <string name="rightParen">)</string>
+    <!-- Do not translate. Unicode square root sign; don't translate. Displayed on button on screen. -->
+    <string name="sqrt">\u221a</string>
+    <!-- Do not translate. Displayed on buttons on screen. -->
+    <string name="power">^</string>
+    <!-- Do not translate. -->
+    <string name="factorial">!</string>
+    <!-- Menu item text to take user to the screen with the basic digits and operators. -->
+    <string name="basic">"Проста панель"</string>
+    <!-- Menu item text to take user to the screen with the advanced functions, such as sin, cos, ln, log, etc. -->
+    <string name="advanced">"Розширена панель"</string>
+    <!-- Menu item text to clear the calculation history. -->
+    <string name="clear_history">"Очистити історію"</string>
+</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 76f3f13..54171e9 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -15,6 +15,6 @@
 -->
 
 <resources>
-    <color name="magic_flame">#00ff2222</color>
+    <color name="magic_flame">#00ffffff</color>
     <color name="button_text">#ffffffff</color>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1fc670b..8aaa6fe 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -6,25 +6,27 @@
        <item name="android:layout_height">fill_parent</item>
        <item name="android:layout_weight">1</item>
        <item name="android:focusable">true</item>
+       <item name="android:background">@drawable/button</item>
+       <item name="android:layout_marginLeft">1dp</item>
     </style>
 
-    <style name="button_small_style">
+    <style name="digit_button_style" parent="button_style">
+       <item name="android:background">@drawable/blue_button</item>
+    </style>
+
+    <style name="button_small_style" parent="button_style">
        <item name="android:textSize">30dp</item>
-       <item name="android:layout_width">fill_parent</item>
-       <item name="android:layout_height">fill_parent</item>
-       <item name="android:layout_weight">1</item>
-       <item name="android:focusable">true</item>
     </style>
 
     <style name="display_style">
        <item name="android:textSize">40dp</item>
-       <item name="android:gravity">right</item>
-       <item name="android:textColor">#f000</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">fill_parent</item>
-       <item name="android:layout_height">wrap_content</item>
+       <item name="android:layout_height">fill_parent</item>
        <item name="android:padding">8dp</item>
     </style>
 </resources>
diff --git a/src/com/android/calculator2/Calculator.java b/src/com/android/calculator2/Calculator.java
index eb7453d..d5c5030 100644
--- a/src/com/android/calculator2/Calculator.java
+++ b/src/com/android/calculator2/Calculator.java
@@ -20,13 +20,14 @@
 import android.os.Bundle;
 import android.util.Log;
 import android.util.Config;
+import android.util.TypedValue;
+import android.view.Display;
 import android.view.Menu;
 import android.view.MenuItem;
-import android.view.Window;
 import android.view.View;
+import android.view.KeyEvent;
 import android.widget.Button;
-import android.widget.ListView;
-import android.content.res.Configuration;
+import android.widget.TextView;
 
 public class Calculator extends Activity {
     EventListener mListener = new EventListener();
@@ -40,6 +41,9 @@
     private static final int CMD_BASIC_PANEL    = 2;
     private static final int CMD_ADVANCED_PANEL = 3;
 
+    private static final int HVGA_HEIGHT_PIXELS = 480;
+    private static final int HVGA_WIDTH_PIXELS  = 320;
+
     static final int BASIC_PANEL    = 0;
     static final int ADVANCED_PANEL = 1;
 
@@ -50,7 +54,7 @@
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
-        requestWindowFeature(Window.FEATURE_NO_TITLE);
+
         setContentView(R.layout.main);
 
         mPersist = new Persist(this);
@@ -70,7 +74,7 @@
 
 
         if ((view = findViewById(R.id.del)) != null) {
-            view.setOnClickListener(mListener);
+//            view.setOnClickListener(mListener);
             view.setOnLongClickListener(mListener);
         }
         /*
@@ -78,13 +82,6 @@
             view.setOnClickListener(mListener);
         }
         */
-
-        /*
-        ListView historyPad = (ListView) findViewById(R.id.historyPad);
-        if (historyPad != null) {
-            historyPad.setAdapter(historyAdapter);
-        }
-        */
     }
 
     @Override
@@ -153,9 +150,33 @@
         mPersist.save();
     }
 
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent keyEvent) {
+        if (keyCode == KeyEvent.KEYCODE_BACK 
+            && mPanelSwitcher.getCurrentIndex() == ADVANCED_PANEL) {
+            mPanelSwitcher.moveRight();
+            return true;
+        } else {
+            return super.onKeyDown(keyCode, keyEvent);
+        }
+    }
+
     static void log(String message) {
         if (LOG_ENABLED) {
             Log.v(LOG_TAG, message);
         }
     }
+
+    /**
+     * The font sizes in the layout files are specified for a HVGA display.
+     * Adjust the font sizes accordingly if we are running on a different
+     * display.
+     */
+    public void adjustFontSize(TextView view) {
+        float fontPixelSize = view.getTextSize();
+        Display display = getWindowManager().getDefaultDisplay();
+        int h = Math.min(display.getWidth(), display.getHeight());
+        float ratio = (float)h/HVGA_WIDTH_PIXELS;
+        view.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontPixelSize*ratio);
+    }
 }
diff --git a/src/com/android/calculator2/CalculatorDisplay.java b/src/com/android/calculator2/CalculatorDisplay.java
index 5e0d76f..130446e 100644
--- a/src/com/android/calculator2/CalculatorDisplay.java
+++ b/src/com/android/calculator2/CalculatorDisplay.java
@@ -21,14 +21,13 @@
 import android.text.Spanned;
 import android.text.method.NumberKeyListener;
 import android.util.AttributeSet;
-import android.view.KeyEvent;
 import android.view.animation.TranslateAnimation;
 import android.text.InputType;
 import android.widget.EditText;
+import android.widget.TextView;
 import android.widget.ViewSwitcher;
 import android.graphics.Rect;
-
-import java.util.Map;
+import android.graphics.Paint;
 
 /**
  * Provides vertical scrolling for the input/result EditText.
@@ -45,12 +44,43 @@
     TranslateAnimation outAnimUp;
     TranslateAnimation inAnimDown;
     TranslateAnimation outAnimDown;
+
+    private Logic mLogic;
+    private boolean mComputedLineLength = false;
     
     public CalculatorDisplay(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
     
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+        Calculator calc = (Calculator) getContext();
+        calc.adjustFontSize((TextView)getChildAt(0));
+        calc.adjustFontSize((TextView)getChildAt(1));
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+        super.onLayout(changed, left, top, right, bottom);
+        if (!mComputedLineLength) {
+            mLogic.setLineLength(getNumberFittingDigits((TextView) getCurrentView()));
+            mComputedLineLength = true;
+        }
+    }
+
+    // compute the maximum number of digits that fit in the
+    // calculator display without scrolling.
+    private int getNumberFittingDigits(TextView display) {
+        int available = display.getWidth()
+            - display.getTotalPaddingLeft() - display.getTotalPaddingRight();
+        Paint paint = display.getPaint();
+        float digitWidth = paint.measureText("2222222222") / 10f;
+        return (int) (available / digitWidth);
+    }
+
     protected void setLogic(Logic logic) {
+        mLogic = logic;
         NumberKeyListener calculatorKeyListener =
             new NumberKeyListener() {
                 public int getInputType() {
diff --git a/src/com/android/calculator2/CalculatorEditable.java b/src/com/android/calculator2/CalculatorEditable.java
index 60ba817..cfa39f6 100644
--- a/src/com/android/calculator2/CalculatorEditable.java
+++ b/src/com/android/calculator2/CalculatorEditable.java
@@ -61,11 +61,6 @@
         if (length == 1) {
             char text = delta.charAt(0);
 
-            //don't allow leading operator + * /
-            if (start == 0 && Logic.isOperator(text) && text != Logic.MINUS) {
-                return super.replace(start, end, "");
-            }
-
             //don't allow two dots in the same number
             if (text == '.') {
                 int p = start - 1;
@@ -92,6 +87,11 @@
                     prevChar = start > 0 ? charAt(start-1) : '\0';
                 }
             }
+
+            //don't allow leading operator + * /
+            if (start == 0 && Logic.isOperator(text) && text != Logic.MINUS) {
+                return super.replace(start, end, "");
+            }
         } 
         return super.replace(start, end, delta);
     }
diff --git a/src/com/android/calculator2/ColorButton.java b/src/com/android/calculator2/ColorButton.java
index 5d78446..c95ea8b 100644
--- a/src/com/android/calculator2/ColorButton.java
+++ b/src/com/android/calculator2/ColorButton.java
@@ -18,10 +18,8 @@
 
 import android.content.Context;
 import android.graphics.Canvas;
-import android.graphics.Color;
 import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.drawable.Drawable;
+import android.graphics.Paint.Style;
 import android.util.AttributeSet;
 import android.widget.Button;
 import android.view.View.OnClickListener;
@@ -29,8 +27,6 @@
 import android.view.MotionEvent;
 import android.content.res.Resources;
 
-import java.util.Map;
-
 /**
  * Button with click-animation effect.
  */
@@ -39,47 +35,41 @@
     static final int CLICK_FEEDBACK_INTERVAL = 10;
     static final int CLICK_FEEDBACK_DURATION = 350;
     
-    Drawable mButtonBackground;
-    Drawable mButton;
     float mTextX;
     float mTextY;
     long mAnimStart;
     OnClickListener mListener;
+    Paint mFeedbackPaint;
     
     public ColorButton(Context context, AttributeSet attrs) {
         super(context, attrs);
-        init();
-        mListener = ((Calculator) context).mListener;
+        Calculator calc = (Calculator) context;
+        init(calc);
+        mListener = calc.mListener;
         setOnClickListener(this);
     }
 
     public void onClick(View view) {
-        animateClickFeedback();
         mListener.onClick(this);
     }
 
-    private void init() {
-        setBackgroundDrawable(null);
-
+    private void init(Calculator calc) {
         Resources res = getResources();
 
-        mButtonBackground = res.getDrawable(R.drawable.button_bg);
-        mButton = res.getDrawable(R.drawable.button);
         CLICK_FEEDBACK_COLOR = res.getColor(R.color.magic_flame);
+        mFeedbackPaint = new Paint();
+        mFeedbackPaint.setStyle(Style.STROKE);
+        mFeedbackPaint.setStrokeWidth(2);
         getPaint().setColor(res.getColor(R.color.button_text));
         
         mAnimStart = -1;
+
+        calc.adjustFontSize(this);
     }
 
 
     @Override 
     public void onSizeChanged(int w, int h, int oldW, int oldH) {
-        int selfW = mButton.getIntrinsicWidth();
-        int selfH = mButton.getIntrinsicHeight();
-        int marginX = (w - selfW) / 2;
-        int marginY = (h - selfH) / 2;
-        mButtonBackground.setBounds(marginX, marginY, marginX + selfW, marginY + selfH);
-        mButton.setBounds(marginX, marginY, marginX + selfW, marginY + selfH);
         measureText();
     }
 
@@ -97,14 +87,9 @@
     private void drawMagicFlame(int duration, Canvas canvas) {
         int alpha = 255 - 255 * duration / CLICK_FEEDBACK_DURATION;
         int color = CLICK_FEEDBACK_COLOR | (alpha << 24);
-        mButtonBackground.setColorFilter(color, PorterDuff.Mode.SRC_IN);
-        
-        int cx = getWidth() / 2;
-        int cy = getHeight() / 2;
-        float angle = 250.0f * duration / CLICK_FEEDBACK_DURATION;
-        canvas.rotate(angle, cx, cy);
-        mButtonBackground.draw(canvas);
-        canvas.rotate(-angle, cx, cy);
+
+        mFeedbackPaint.setColor(color);
+        canvas.drawRect(1, 1, getWidth() - 1, getHeight() - 1, mFeedbackPaint);
     }
 
     @Override
@@ -113,7 +98,6 @@
             int animDuration = (int) (System.currentTimeMillis() - mAnimStart);
             
             if (animDuration >= CLICK_FEEDBACK_DURATION) {
-                mButtonBackground.clearColorFilter();
                 mAnimStart = -1;
             } else {
                 drawMagicFlame(animDuration, canvas);
@@ -123,8 +107,6 @@
             drawMagicFlame(0, canvas);
         }
         
-        mButton.draw(canvas);
-        
         CharSequence text = getText();
         canvas.drawText(text, 0, text.length(), mTextX, mTextY, getPaint());
     }
@@ -136,12 +118,18 @@
     
     @Override
     public boolean onTouchEvent(MotionEvent event) {
-        int a = event.getAction();
-        if (a == MotionEvent.ACTION_DOWN 
-                || a == MotionEvent.ACTION_CANCEL
-                || a == MotionEvent.ACTION_UP) {
-            invalidate();
+        boolean result = super.onTouchEvent(event);
+
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_UP:
+                animateClickFeedback();
+                break;
+            case MotionEvent.ACTION_DOWN:
+            case MotionEvent.ACTION_CANCEL:
+                invalidate();
+                break;
         }
-        return super.onTouchEvent(event);
+
+        return result;
     }
 }
diff --git a/src/com/android/calculator2/Logic.java b/src/com/android/calculator2/Logic.java
index 244f438..bd066de 100644
--- a/src/com/android/calculator2/Logic.java
+++ b/src/com/android/calculator2/Logic.java
@@ -35,11 +35,8 @@
     private Button mEqualButton;
     private final String mEnterString;
     private boolean mIsError = false;
-    private final boolean mOrientationPortrait;
-    private final int mLineLength;
+    private int mLineLength = 0;
 
-    private static final int LINE_LENGTH_PORTRAIT = 14;
-    private static final int LINE_LENGTH_LANDSCAPE = 21;
     private static final String INFINITY_UNICODE = "\u221e";
 
     // the two strings below are the result of Double.toString() for Infinity & NaN
@@ -53,10 +50,6 @@
 
     Logic(Context context, History history, CalculatorDisplay display, Button equalButton) {
         mErrorString = context.getResources().getString(R.string.error);
-        mOrientationPortrait = context.getResources().getConfiguration().orientation
-            == Configuration.ORIENTATION_PORTRAIT;
-        mLineLength = mOrientationPortrait ? LINE_LENGTH_PORTRAIT : LINE_LENGTH_LANDSCAPE;
-
         try {
             // in calculator we use log() for base-10,
             // unlike in arity-lib where log() is natural logarithm
@@ -73,6 +66,10 @@
         clearWithHistory(false);
     }
 
+    void setLineLength(int nDigits) {
+        mLineLength = nDigits;
+    }
+
     boolean eatHorizontalMove(boolean toLeft) {
         EditText editText = mDisplay.getEditText();
         int cursorPos = editText.getSelectionStart();