diff options
author | Hans Boehm <hboehm@google.com> | 2015-04-21 13:18:38 -0700 |
---|---|---|
committer | Hans Boehm <hboehm@google.com> | 2015-04-28 00:35:23 +0000 |
commit | 08e8f322b0d93e06aaa2a15acc869dfd70791461 (patch) | |
tree | 030d2d655227ffc3c71b8af92918881d250f0284 /res | |
parent | 9e855e82dc86b3038b3e048a56be77af114e24f4 (diff) | |
download | android_packages_apps_ExactCalculator-08e8f322b0d93e06aaa2a15acc869dfd70791461.tar.gz android_packages_apps_ExactCalculator-08e8f322b0d93e06aaa2a15acc869dfd70791461.tar.bz2 android_packages_apps_ExactCalculator-08e8f322b0d93e06aaa2a15acc869dfd70791461.zip |
Restructure display formatting, use TextView for formula.
This fixes issues with inappropriate keyboard popups and cleans
up the code.
This substantially rewrites the result formatting code;
it intentionally removes a heuristic to avoid conventional scientific
notation for short results, which only seemed to confuse things.
There are some other tweaks and simplifications. Transitions
to and from conventional scientific notation should be smoother,
though there is still an issue with numbers like 10^-30.
The formatting code is completely extracted from Evaluator, cutting
off various tentacles, and moved to CalculatorResult.
Fixes a bug that resulted in digits being inappropriately
displayed without an exponent if the decimal point was just off
the left edge of the screen.
It's still not clear that we should always be integrating the
exponent into the result window.
Bug: 20483801
Bug: 20480081
Change-Id: I1bb777b871e9fa8b6cd510c533e4b94bde6d4a20
Diffstat (limited to 'res')
-rw-r--r-- | res/layout/display.xml | 7 | ||||
-rw-r--r-- | res/values-land/styles.xml | 2 | ||||
-rw-r--r-- | res/values-port/styles.xml | 2 | ||||
-rw-r--r-- | res/values-sw600dp-land/styles.xml | 2 | ||||
-rw-r--r-- | res/values-sw600dp-port/styles.xml | 2 | ||||
-rw-r--r-- | res/values-sw800dp-land/styles.xml | 2 | ||||
-rw-r--r-- | res/values-sw800dp-port/styles.xml | 2 | ||||
-rw-r--r-- | res/values/attr.xml | 2 | ||||
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/values/styles.xml | 8 |
10 files changed, 11 insertions, 20 deletions
diff --git a/res/layout/display.xml b/res/layout/display.xml index 2132a46..1fe2cf7 100644 --- a/res/layout/display.xml +++ b/res/layout/display.xml @@ -38,15 +38,16 @@ </Toolbar> - <com.android.calculator2.CalculatorEditText + <com.android.calculator2.CalculatorText android:id="@+id/formula" - style="@style/DisplayEditTextStyle.Formula" + style="@style/DisplayTextStyle.Formula" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/toolbar" - android:inputType="none" + android:ellipsize="none" android:longClickable="true" android:singleLine="true" + android:scrollHorizontally="true" android:textColor="@color/display_formula_text_color" android:textIsSelectable="false" /> diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml index 1cfcf4f..828d9ac 100644 --- a/res/values-land/styles.xml +++ b/res/values-land/styles.xml @@ -18,7 +18,7 @@ <!-- Styles for landscape phone (e.g. Nexus 4/5). --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="DisplayEditTextStyle.Formula"> + <style name="DisplayTextStyle.Formula"> <item name="android:paddingTop">0dip</item> <item name="android:paddingBottom">12dip</item> <item name="android:paddingStart">32dip</item> diff --git a/res/values-port/styles.xml b/res/values-port/styles.xml index aae4ca1..3a7ad3e 100644 --- a/res/values-port/styles.xml +++ b/res/values-port/styles.xml @@ -18,7 +18,7 @@ <!-- Styles for portrait phone (e.g. Nexus 4/5). --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="DisplayEditTextStyle.Formula"> + <style name="DisplayTextStyle.Formula"> <item name="android:paddingTop">8dip</item> <item name="android:paddingBottom">24dip</item> <item name="android:paddingStart">16dip</item> diff --git a/res/values-sw600dp-land/styles.xml b/res/values-sw600dp-land/styles.xml index dcbfeb4..e97f2ab 100644 --- a/res/values-sw600dp-land/styles.xml +++ b/res/values-sw600dp-land/styles.xml @@ -18,7 +18,7 @@ <!-- Styles for landscape 600dip-wide tablet (e.g. Nexus 7). --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="DisplayEditTextStyle.Formula"> + <style name="DisplayTextStyle.Formula"> <item name="android:paddingTop">0dip</item> <item name="android:paddingBottom">52dip</item> <item name="android:paddingStart">44dip</item> diff --git a/res/values-sw600dp-port/styles.xml b/res/values-sw600dp-port/styles.xml index 623f4c0..9cd76ce 100644 --- a/res/values-sw600dp-port/styles.xml +++ b/res/values-sw600dp-port/styles.xml @@ -19,7 +19,7 @@ <!-- Styles for portrait 600dip-wide tablet (e.g. Nexus 7). --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="DisplayEditTextStyle.Formula"> + <style name="DisplayTextStyle.Formula"> <item name="android:paddingTop">16dip</item> <item name="android:paddingBottom">48dip</item> <item name="android:paddingStart">44dip</item> diff --git a/res/values-sw800dp-land/styles.xml b/res/values-sw800dp-land/styles.xml index b834d8c..7952971 100644 --- a/res/values-sw800dp-land/styles.xml +++ b/res/values-sw800dp-land/styles.xml @@ -18,7 +18,7 @@ <!-- Styles for landscape 800dip-wide tablet (e.g. Nexus 10). --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="DisplayEditTextStyle.Formula"> + <style name="DisplayTextStyle.Formula"> <item name="android:paddingTop">16dip</item> <item name="android:paddingBottom">42dip</item> <item name="android:paddingStart">44dip</item> diff --git a/res/values-sw800dp-port/styles.xml b/res/values-sw800dp-port/styles.xml index 881a033..bca0b13 100644 --- a/res/values-sw800dp-port/styles.xml +++ b/res/values-sw800dp-port/styles.xml @@ -18,7 +18,7 @@ <!-- Styles for portrait 800dip-wide tablet (e.g. Nexus 10). --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="DisplayEditTextStyle.Formula"> + <style name="DisplayTextStyle.Formula"> <item name="android:paddingTop">16dip</item> <item name="android:paddingBottom">68dip</item> <item name="android:paddingStart">44dip</item> diff --git a/res/values/attr.xml b/res/values/attr.xml index 5043663..cfefc9d 100644 --- a/res/values/attr.xml +++ b/res/values/attr.xml @@ -17,7 +17,7 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <declare-styleable name="CalculatorEditText"> + <declare-styleable name="CalculatorText"> <attr name="minTextSize" format="dimension" /> <attr name="maxTextSize" format="dimension" /> <attr name="stepTextSize" format="dimension" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index 2b621bb..3d10202 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -75,8 +75,6 @@ <!-- Abbrev. name of radian mode [CHAR_LIMIT=5] --> <!-- Used both as button label and for status indicator on top --> <string name="mode_rad">rad</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> diff --git a/res/values/styles.xml b/res/values/styles.xml index 12295e5..69a537a 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -25,14 +25,6 @@ <item name="android:windowContentOverlay">@null</item> </style> - <style name="DisplayEditTextStyle" parent="@android:style/Widget.Material.Light.EditText"> - <item name="android:background">@android:color/transparent</item> - <item name="android:cursorVisible">false</item> - <item name="android:fontFamily">sans-serif-light</item> - <item name="android:includeFontPadding">false</item> - <item name="android:gravity">bottom|end</item> - </style> - <style name="DisplayTextStyle" parent="@android:style/Widget.Material.Light.TextView"> <item name="android:background">@android:color/transparent</item> <item name="android:cursorVisible">false</item> |