summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2014-11-25 18:46:17 -0800
committerHans Boehm <hboehm@google.com>2015-03-06 15:45:31 -0800
commit84614957604253d51296e06c97daced699a0a9de (patch)
tree45f357dd9d08ea01ee5073e0dda6728ebc7da884 /res
parent2d5303e87e3b7f23f626ca1fe32045352d96aea4 (diff)
downloadandroid_packages_apps_ExactCalculator-84614957604253d51296e06c97daced699a0a9de.tar.gz
android_packages_apps_ExactCalculator-84614957604253d51296e06c97daced699a0a9de.tar.bz2
android_packages_apps_ExactCalculator-84614957604253d51296e06c97daced699a0a9de.zip
Beginnings of ExactCalculator based on L
Replace the arity library with a new evaluation engine based on an open source "constructive reals" library. This provides answers that are correct to the last displayed digit, and can be scrolled to get more precision, with evaluation to additional precision proceeding on demand. This uses pieces of an old prototype calculator with a pre-Material-Design UI. Since the code structure of the KitKat and Lollipop calculators is quite different, this merge required major changes to make the pieces fit again. An egregious bug in the prototype related to the evaluation of the power operator was fixed. Many new UI bugs are introduced to compensate :-) Add separate buttons for inverse trig functions. Add long TODO lists for various missing pieces. This is really designed to get something up and running that looks like it has a Material Design UI. This version kind of works, though with many UI deficiencies. This addresses external issues 63368, 81089, and 80990. It partially address the degree vs radian (80330) issue as well, though we're still missing the UI for that. This fixes Bug:15284587 (More work is needed to make this interact correctly with keyboard support.) Degree/Radian mode is also internal Bug:17059768 This provides much more robust solutions to the following, which were previously fixed by favoring round numbers over precise solutions: Bug:15747298 Bug:15332726 Change-Id: Ib64ffcee9760a3195ae2a48302308eeb09a156bd
Diffstat (limited to 'res')
-rw-r--r--res/drawable-hdpi/ic_more_vert_grey600_24dp.pngbin0 -> 221 bytes
-rw-r--r--res/drawable-mdpi/ic_more_vert_grey600_24dp.pngbin0 -> 202 bytes
-rw-r--r--res/drawable-xhdpi/ic_more_vert_grey600_24dp.pngbin0 -> 252 bytes
-rw-r--r--res/drawable-xxhdpi/ic_more_vert_grey600_24dp.pngbin0 -> 316 bytes
-rw-r--r--res/drawable-xxxhdpi/ic_more_vert_grey600_24dp.pngbin0 -> 403 bytes
-rw-r--r--res/layout/activity_calculator_land.xml6
-rw-r--r--res/layout/activity_calculator_port.xml5
-rw-r--r--res/layout/display.xml4
-rw-r--r--res/layout/extras.xml44
-rw-r--r--res/layout/pad_advanced.xml21
-rw-r--r--res/menu/menu.xml28
-rw-r--r--res/mipmap-hdpi/ic_launcher_calculator.pngbin3580 -> 3649 bytes
-rw-r--r--res/mipmap-mdpi/ic_launcher_calculator.pngbin2291 -> 2326 bytes
-rw-r--r--res/mipmap-xhdpi/ic_launcher_calculator.pngbin4949 -> 5131 bytes
-rw-r--r--res/mipmap-xxhdpi/ic_launcher_calculator.pngbin8008 -> 8076 bytes
-rw-r--r--res/mipmap-xxxhdpi/ic_launcher_calculator.pngbin10711 -> 10728 bytes
-rw-r--r--res/values-land/styles.xml2
-rw-r--r--res/values-port/styles.xml4
-rw-r--r--res/values/donottranslate_strings.xml2
-rw-r--r--res/values/strings.xml44
20 files changed, 151 insertions, 9 deletions
diff --git a/res/drawable-hdpi/ic_more_vert_grey600_24dp.png b/res/drawable-hdpi/ic_more_vert_grey600_24dp.png
new file mode 100644
index 0000000..e141502
--- /dev/null
+++ b/res/drawable-hdpi/ic_more_vert_grey600_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_more_vert_grey600_24dp.png b/res/drawable-mdpi/ic_more_vert_grey600_24dp.png
new file mode 100644
index 0000000..4ed3435
--- /dev/null
+++ b/res/drawable-mdpi/ic_more_vert_grey600_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_more_vert_grey600_24dp.png b/res/drawable-xhdpi/ic_more_vert_grey600_24dp.png
new file mode 100644
index 0000000..7bc63a5
--- /dev/null
+++ b/res/drawable-xhdpi/ic_more_vert_grey600_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_more_vert_grey600_24dp.png b/res/drawable-xxhdpi/ic_more_vert_grey600_24dp.png
new file mode 100644
index 0000000..44012b8
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_more_vert_grey600_24dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_more_vert_grey600_24dp.png b/res/drawable-xxxhdpi/ic_more_vert_grey600_24dp.png
new file mode 100644
index 0000000..0042578
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_more_vert_grey600_24dp.png
Binary files differ
diff --git a/res/layout/activity_calculator_land.xml b/res/layout/activity_calculator_land.xml
index 1fe12db..9182598 100644
--- a/res/layout/activity_calculator_land.xml
+++ b/res/layout/activity_calculator_land.xml
@@ -21,6 +21,12 @@
android:layout_height="match_parent"
android:orientation="vertical">
+ <!-- Unclear we actually have the vertical space to do this. Revisit! -->
+ <include
+ layout="@layout/extras"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
<include
layout="@layout/display"
android:layout_width="match_parent"
diff --git a/res/layout/activity_calculator_port.xml b/res/layout/activity_calculator_port.xml
index 0cb5dc7..3b4351a 100644
--- a/res/layout/activity_calculator_port.xml
+++ b/res/layout/activity_calculator_port.xml
@@ -22,6 +22,11 @@
android:orientation="vertical">
<include
+ layout="@layout/extras"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <include
layout="@layout/display"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
diff --git a/res/layout/display.xml b/res/layout/display.xml
index 066838a..94f7848 100644
--- a/res/layout/display.xml
+++ b/res/layout/display.xml
@@ -31,7 +31,7 @@
android:inputType="text|textNoSuggestions"
android:textColor="@color/display_formula_text_color" />
- <com.android.calculator2.CalculatorEditText
+ <com.android.calculator2.CalculatorResult
android:id="@+id/result"
style="@style/DisplayEditTextStyle.Result"
android:layout_width="match_parent"
@@ -41,4 +41,4 @@
android:focusable="false"
android:textColor="@color/display_result_text_color" />
-</RelativeLayout> \ No newline at end of file
+</RelativeLayout>
diff --git a/res/layout/extras.xml b/res/layout/extras.xml
new file mode 100644
index 0000000..ec7418d
--- /dev/null
+++ b/res/layout/extras.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+
+ -->
+
+<!--
+ TODO: Use framework Toolbar instead of custom overflow menu.
+ -->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/display"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:background="@color/display_background_color"
+ android:gravity="right"
+ android:elevation="4dip">
+
+ <!-- Degree/Radian display goes here. Use gravity="left" -->
+
+ <ImageButton
+ android:id="@+id/overflow_menu"
+ android:layout_width="48dip"
+ android:layout_height="match_parent"
+ android:src="@drawable/ic_more_vert_grey600_24dp"
+ android:background="?android:attr/selectableItemBackgroundBorderless"
+ android:contentDescription="@string/overflow_menu_description"
+ android:onClick="onButtonClick" />
+
+</LinearLayout>
diff --git a/res/layout/pad_advanced.xml b/res/layout/pad_advanced.xml
index 5e8fec0..eb91b48 100644
--- a/res/layout/pad_advanced.xml
+++ b/res/layout/pad_advanced.xml
@@ -43,6 +43,27 @@
android:text="@string/fun_tan" />
<Button
+ android:id="@+id/fun_arcsin"
+ style="@style/PadButtonStyle.Advanced"
+ android:contentDescription="@string/desc_fun_arcsin"
+ android:onClick="onButtonClick"
+ android:text="@string/fun_arcsin" />
+
+ <Button
+ android:id="@+id/fun_arccos"
+ style="@style/PadButtonStyle.Advanced"
+ android:contentDescription="@string/desc_fun_arccos"
+ android:onClick="onButtonClick"
+ android:text="@string/fun_arccos" />
+
+ <Button
+ android:id="@+id/fun_arctan"
+ style="@style/PadButtonStyle.Advanced"
+ android:contentDescription="@string/desc_fun_arctan"
+ android:onClick="onButtonClick"
+ android:text="@string/fun_arctan" />
+
+ <Button
android:id="@+id/fun_ln"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_ln"
diff --git a/res/menu/menu.xml b/res/menu/menu.xml
new file mode 100644
index 0000000..16712ea
--- /dev/null
+++ b/res/menu/menu.xml
@@ -0,0 +1,28 @@
+<?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/menu_help"
+ android:title="@string/help"/>
+
+ <item android:id="@+id/menu_about"
+ android:title="@string/about"/>
+
+</menu>
diff --git a/res/mipmap-hdpi/ic_launcher_calculator.png b/res/mipmap-hdpi/ic_launcher_calculator.png
index 6ea7fc4..e943cb4 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 534b165..c1cb23a 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 2e90135..f09c7a6 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 9bb8754..098f545 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 567c539..5e57435 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-land/styles.xml b/res/values-land/styles.xml
index f82c152..ac8a566 100644
--- a/res/values-land/styles.xml
+++ b/res/values-land/styles.xml
@@ -74,7 +74,7 @@
<item name="android:paddingStart">8dip</item>
<item name="android:paddingEnd">8dip</item>
<item name="android:columnCount">3</item>
- <item name="android:rowCount">4</item>
+ <item name="android:rowCount">5</item>
</style>
<style name="PadLayoutStyle.Numeric">
diff --git a/res/values-port/styles.xml b/res/values-port/styles.xml
index d2de4b5..ff6e303 100644
--- a/res/values-port/styles.xml
+++ b/res/values-port/styles.xml
@@ -69,7 +69,7 @@
<item name="android:paddingStart">20dip</item>
<item name="android:paddingEnd">20dip</item>
<item name="android:columnCount">3</item>
- <item name="android:rowCount">4</item>
+ <item name="android:rowCount">5</item>
</style>
<style name="PadLayoutStyle.Numeric">
@@ -90,4 +90,4 @@
<item name="android:paddingEnd">28dip</item>
</style>
-</resources> \ No newline at end of file
+</resources>
diff --git a/res/values/donottranslate_strings.xml b/res/values/donottranslate_strings.xml
index 69d2959..1ef264e 100644
--- a/res/values/donottranslate_strings.xml
+++ b/res/values/donottranslate_strings.xml
@@ -44,7 +44,5 @@
<!-- Equals operator (e.g. "1 + 2 = ?"). [CHAR_LIMIT=1] -->
<string name="eq">=</string>
- <!-- Result displayed when expression evaluates to infinity. [CHAR_LIMIT=1] -->
- <string name="inf">∞</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index bcdd55e..408d5ec 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -20,10 +20,14 @@
<!-- Name of the application. [CHAR_LIMIT=NONE] -->
<string name="app_name">Calculator</string>
- <!-- Error displayed when expression evaluates to NaN. [CHAR_LIMIT=14] -->
+ <!-- Error displayed when expression evaluates a function at undefined point. [CHAR_LIMIT=14] -->
<string name="error_nan">Not a number</string>
<!-- Error displayed when expression contains a syntax error. [CHAR_LIMIT=14] -->
- <string name="error_syntax">Error</string>
+ <string name="error_syntax">Malformed expression</string>
+ <!-- Error displayed when evaluation is manually aborted. [CHAR_LIMIT=14] -->
+ <string name="error_aborted">Aborted</string>
+ <!-- Error displayed when excessive precision is required. [CHAR_LIMIT=14] -->
+ <string name="error_overflow">Infinite?</string>
<!-- Decimal separator (e.g. "1.23"). [CHAR_LIMIT=1] -->
<string name="dec_point">.</string>
@@ -59,6 +63,14 @@
<string name="fun_sin">sin</string>
<!-- Abbrev. name of tangent function (e.g. "tan(π)". [CHAR_LIMIT=3] -->
<string name="fun_tan">tan</string>
+ <!-- Abbrev. name of cosine function (e.g. "arccos(π)". Often cos with a -1 superscript [CHAR_LIMIT=5] -->
+ <string name="fun_arccos">cos\u207B\u00B9</string>
+ <!-- Abbrev. name of sine function (e.g. "arcsin(π)". [CHAR_LIMIT=5] -->
+ <string name="fun_arcsin">sin\u207B\u00B9</string>
+ <!-- Abbrev. name of tangent function (e.g. "arctan(π)". [CHAR_LIMIT=5] -->
+ <string name="fun_arctan">tan\u207B\u00B9</string>
+ <!-- Ellipsis string used in display (e.g. "...". [CHAR_LIMIT=3] -->
+ <string name="ellipsis">\u2026</string>
<!-- Clear operation to clear the currently entered expression. [CHAR_LIMIT=3] -->
<string name="clr">clr</string>
@@ -91,6 +103,12 @@
<string name="desc_fun_sin">sine</string>
<!-- Content description for 'tan' button. [CHAR_LIMIT=NONE] -->
<string name="desc_fun_tan">tangent</string>
+ <!-- Content description for 'arccos' button. [CHAR_LIMIT=NONE] -->
+ <string name="desc_fun_arccos">inverse cosine</string>
+ <!-- Content description for 'arcsin' button. [CHAR_LIMIT=NONE] -->
+ <string name="desc_fun_arcsin">inverse sine</string>
+ <!-- Content description for 'arctan' button. [CHAR_LIMIT=NONE] -->
+ <string name="desc_fun_arctan">inverse tangent</string>
<!-- Content description for '+' button. [CHAR_LIMIT=NONE] -->
<string name="desc_op_add">plus</string>
@@ -114,4 +132,26 @@
<!-- Content description for '=' button. [CHAR_LIMIT=NONE] -->
<string name="desc_eq">equals</string>
+ <!-- TODO: Revisit everything below here -->
+ <!-- Displayed briefly to indicate not-yet-computed digit. -->
+ <string name="guessed_digit">"?"</string>
+ <!-- Dialog message when a computation is cancelled by the user. -->
+ <string name="cancelled">Computation cancelled!</string>
+ <!-- Button label to dismiss informative text message. -->
+ <string name="dismiss">Dismiss</string>
+ <!-- Dialog message when a computation times out. -->
+ <string name="timeout">Timed out trying to compute an infinite or huge number</string>
+ <!-- Button label for "remove timeout" button. -->
+ <string name="ok_remove_timeout">OK, but longer timeouts, please!</string>
+ <!-- Help menu entry for context menu. -->
+ <string name="help">Help!</string>
+ <!-- Content description for overflow menu button. -->
+ <string name="overflow_menu_description">overflow menu</string>
+ <!-- The help message that's displayed in response to pushing the above button. -->
+ <string name="help_message">Use the keys to enter a standard arithmetic expression. It\'s fine to omit multiplication symbols and trailing parentheses. The result displayed after hitting = is computed to an error of less than one in the last displayed digit. Drag the display to see more digits.\n\nComputations involving infinite values may take forever. Touch a button to terminate computation or wait for the timeout.</string>
+ <!-- Help message addendum for pager. -->
+ <string name="help_pager">\n\nSwipe the keyboard to the left to see additional functions.</string>
+ <!-- About menu entry; leads mostly to (English language!) copyright notice. -->
+ <string name="about">About &amp; Copyright</string>
+
</resources>