Loading proguard.flags +2 −0 Original line number Original line Diff line number Diff line Loading @@ -54,3 +54,5 @@ # Some small BoundedRational methods like equals() are not used by the # Some small BoundedRational methods like equals() are not used by the # calculator, but crucial for testing. # calculator, but crucial for testing. -keepclassmembers class com.android.calculator2.BoundedRational { *; } -keepclassmembers class com.android.calculator2.BoundedRational { *; } # Need CR comparison operators for testing. -keepclassmembers class com.hp.creals.CR { *; } res/layout/pad_advanced.xml +27 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,15 @@ android:contentDescription="@string/desc_fun_ln" android:contentDescription="@string/desc_fun_ln" android:text="@string/fun_ln" /> android:text="@string/fun_ln" /> <Button android:id="@+id/fun_exp" style="@style/PadButtonStyle.Advanced" android:layout_row="2" android:layout_column="0" android:contentDescription="@string/desc_fun_exp" android:text="@string/fun_exp" android:visibility="gone" /> <Button <Button android:id="@+id/fun_log" android:id="@+id/fun_log" style="@style/PadButtonStyle.Advanced" style="@style/PadButtonStyle.Advanced" Loading @@ -114,6 +123,15 @@ android:contentDescription="@string/desc_fun_log" android:contentDescription="@string/desc_fun_log" android:text="@string/fun_log" /> android:text="@string/fun_log" /> <Button android:id="@+id/fun_10pow" style="@style/PadButtonStyle.Advanced" android:layout_row="2" android:layout_column="1" android:contentDescription="@string/desc_fun_10pow" android:text="@string/fun_10pow" android:visibility="gone" /> <Button <Button android:id="@+id/op_fact" android:id="@+id/op_fact" style="@style/PadButtonStyle.Advanced" style="@style/PadButtonStyle.Advanced" Loading Loading @@ -170,4 +188,13 @@ android:contentDescription="@string/desc_op_sqrt" android:contentDescription="@string/desc_op_sqrt" android:text="@string/op_sqrt" /> android:text="@string/op_sqrt" /> <Button android:id="@+id/op_sqr" style="@style/PadButtonStyle.Advanced" android:layout_row="4" android:layout_column="2" android:contentDescription="@string/desc_op_sqr" android:text="@string/op_sqr" android:visibility="gone" /> </GridLayout> </GridLayout> res/layout/pad_advanced_tablet_port.xml +27 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,15 @@ android:contentDescription="@string/desc_fun_ln" android:contentDescription="@string/desc_fun_ln" android:text="@string/fun_ln" /> android:text="@string/fun_ln" /> <Button android:id="@+id/fun_exp" style="@style/PadButtonStyle.Advanced" android:layout_row="1" android:layout_column="1" android:contentDescription="@string/desc_fun_exp" android:text="@string/fun_exp" android:visibility="gone" /> <Button <Button android:id="@+id/fun_log" android:id="@+id/fun_log" style="@style/PadButtonStyle.Advanced" style="@style/PadButtonStyle.Advanced" Loading @@ -114,6 +123,15 @@ android:contentDescription="@string/desc_fun_log" android:contentDescription="@string/desc_fun_log" android:text="@string/fun_log" /> android:text="@string/fun_log" /> <Button android:id="@+id/fun_10pow" style="@style/PadButtonStyle.Advanced" android:layout_row="1" android:layout_column="2" android:contentDescription="@string/desc_fun_10pow" android:text="@string/fun_10pow" android:visibility="gone" /> <Button <Button android:id="@+id/op_fact" android:id="@+id/op_fact" style="@style/PadButtonStyle.Advanced" style="@style/PadButtonStyle.Advanced" Loading Loading @@ -170,4 +188,13 @@ android:contentDescription="@string/desc_op_sqrt" android:contentDescription="@string/desc_op_sqrt" android:text="@string/op_sqrt" /> android:text="@string/op_sqrt" /> <Button android:id="@+id/op_sqr" style="@style/PadButtonStyle.Advanced" android:layout_row="2" android:layout_column="4" android:contentDescription="@string/desc_op_sqr" android:text="@string/op_sqr" android:visibility="gone" /> </GridLayout> </GridLayout> res/values/strings.xml +27 −6 Original line number Original line Diff line number Diff line Loading @@ -78,23 +78,37 @@ <!-- Subtraction operator (e.g. "1 - 2"). [CHAR_LIMIT=1] --> <!-- Subtraction operator (e.g. "1 - 2"). [CHAR_LIMIT=1] --> <string name="op_sub" translatable="false">−</string> <string name="op_sub" translatable="false">−</string> <!-- Abbrev. name of cosine function (e.g. "cos(π)". [CHAR_LIMIT=4] --> <!-- Abbrev. name of cosine function (e.g. "cos(π)"). [CHAR_LIMIT=4] --> <string name="fun_cos" translatable="false">cos</string> <string name="fun_cos" translatable="false">cos</string> <!-- Natural logarithm function (e.g. "ln(2)"). [CHAR_LIMIT=4] --> <!-- Natural logarithm function (e.g. "ln(2)"). [CHAR_LIMIT=4] --> <string name="fun_ln" translatable="false">ln</string> <string name="fun_ln" translatable="false">ln</string> <!-- Logarithm function (e.g. "log(10)"). [CHAR_LIMIT=4] --> <!-- Logarithm function (e.g. "log(10)"). [CHAR_LIMIT=4] --> <string name="fun_log" translatable="false">log</string> <string name="fun_log" translatable="false">log</string> <!-- Abbrev. name of sine function (e.g. "sin(π)". [CHAR_LIMIT=4] --> <!-- Abbrev. name of sine function (e.g. "sin(π)"). [CHAR_LIMIT=4] --> <string name="fun_sin" translatable="false">sin</string> <string name="fun_sin" translatable="false">sin</string> <!-- Abbrev. name of tangent function (e.g. "tan(π)". [CHAR_LIMIT=4] --> <!-- Abbrev. name of tangent function (e.g. "tan(π)"). [CHAR_LIMIT=4] --> <string name="fun_tan" translatable="false">tan</string> <string name="fun_tan" translatable="false">tan</string> <!-- Abbrev. name of cosine function (e.g. "arccos(π)". [CHAR_LIMIT=5] --> <!-- Abbrev. name of cosine function (e.g. "arccos(π)"). [CHAR_LIMIT=5] --> <string name="fun_arccos" translatable="false">cos\u207B\u00B9</string> <string name="fun_arccos" translatable="false">cos\u207B\u00B9</string> <!-- Abbrev. name of sine function (e.g. "arcsin(π)". [CHAR_LIMIT=5] --> <!-- Abbrev. name of sine function (e.g. "arcsin(π)"). [CHAR_LIMIT=5] --> <string name="fun_arcsin" translatable="false">sin\u207B\u00B9</string> <string name="fun_arcsin" translatable="false">sin\u207B\u00B9</string> <!-- Abbrev. name of tangent function (e.g. "arctan(π)". [CHAR_LIMIT=5] --> <!-- Abbrev. name of tangent function (e.g. "arctan(π)"). [CHAR_LIMIT=5] --> <string name="fun_arctan" translatable="false">tan\u207B\u00B9</string> <string name="fun_arctan" translatable="false">tan\u207B\u00B9</string> <!-- Abbrev. name of base 10 exponential function (e.g. "10^6"). [CHAR_LIMIT=5] --> <string name="fun_10pow" translatable="false">10\u02E3</string> <!-- Abbrev. name of exponential function (e.g. "e^6"). [CHAR_LIMIT=5] --> <string name="fun_exp" translatable="false">e\u02E3</string> <!-- Abbrev. name of suffix square function on key (e.g. "17^2"). [CHAR_LIMIT=5] --> <string name="op_sqr" translatable="false">x\u00B2</string> <!-- Abbrev. name of suffix square function in formula. "^2" does not work, since it blends into a later constant. --> <string name="squared" translatable="false">²</string> <!-- Abbrev. name of exponential function in formula. --> <string name="exponential" translatable = "false">exp</string> <!-- Abbrev. name of degree mode [CHAR_LIMIT=4] --> <!-- Abbrev. name of degree mode [CHAR_LIMIT=4] --> <string name="mode_deg">deg</string> <string name="mode_deg">deg</string> <!-- Abbrev. name of radian mode. [CHAR_LIMIT=4] --> <!-- Abbrev. name of radian mode. [CHAR_LIMIT=4] --> Loading Loading @@ -139,6 +153,13 @@ <!-- Content description for 'arctan' button. [CHAR_LIMIT=NONE] --> <!-- Content description for 'arctan' button. [CHAR_LIMIT=NONE] --> <string name="desc_fun_arctan">inverse tangent</string> <string name="desc_fun_arctan">inverse tangent</string> <!-- Content description for 10^ button. [CHAR_LIMIT=NONE] --> <string name="desc_fun_10pow">ten to the power of</string> <!-- Content description for e^ button. [CHAR_LIMIT=NONE] --> <string name="desc_fun_exp">exponential function</string> <!-- Content description for ^2 button. [CHAR_LIMIT=NONE] --> <string name="desc_op_sqr">squared</string> <!-- Content description for '+' button. [CHAR_LIMIT=NONE] --> <!-- Content description for '+' button. [CHAR_LIMIT=NONE] --> <string name="desc_op_add">plus</string> <string name="desc_op_add">plus</string> <!-- Content description for '÷' button. [CHAR_LIMIT=NONE] --> <!-- Content description for '÷' button. [CHAR_LIMIT=NONE] --> Loading src/com/android/calculator2/BoundedRational.java +13 −6 Original line number Original line Diff line number Diff line Loading @@ -229,6 +229,14 @@ public class BoundedRational { return null; return null; } } private static BoundedRational map0to1(BoundedRational r) { if (r == null) return null; if (r.mNum.equals(BigInteger.ZERO)) { return ONE; } return null; } private static BoundedRational map1to0(BoundedRational r) { private static BoundedRational map1to0(BoundedRational r) { if (r == null) return null; if (r == null) return null; if (r.mNum.equals(r.mDen)) { if (r.mNum.equals(r.mDen)) { Loading Loading @@ -345,12 +353,7 @@ public class BoundedRational { } } public static BoundedRational cos(BoundedRational r) { public static BoundedRational cos(BoundedRational r) { // Maps 0 to 1, null otherwise return map0to1(r); if (r == null) return null; if (r.mNum.equals(BigInteger.ZERO)) { return ONE; } return null; } } public static BoundedRational degreeCos(BoundedRational r) { public static BoundedRational degreeCos(BoundedRational r) { Loading Loading @@ -403,6 +406,10 @@ public class BoundedRational { return map1to0(r); return map1to0(r); } } public static BoundedRational exp(BoundedRational r) { return map0to1(r); } // Return the base 10 log of n, if n is a power of 10, -1 otherwise. // Return the base 10 log of n, if n is a power of 10, -1 otherwise. // n must be positive. // n must be positive. private static long b10Log(BigInteger n) { private static long b10Log(BigInteger n) { Loading Loading
proguard.flags +2 −0 Original line number Original line Diff line number Diff line Loading @@ -54,3 +54,5 @@ # Some small BoundedRational methods like equals() are not used by the # Some small BoundedRational methods like equals() are not used by the # calculator, but crucial for testing. # calculator, but crucial for testing. -keepclassmembers class com.android.calculator2.BoundedRational { *; } -keepclassmembers class com.android.calculator2.BoundedRational { *; } # Need CR comparison operators for testing. -keepclassmembers class com.hp.creals.CR { *; }
res/layout/pad_advanced.xml +27 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,15 @@ android:contentDescription="@string/desc_fun_ln" android:contentDescription="@string/desc_fun_ln" android:text="@string/fun_ln" /> android:text="@string/fun_ln" /> <Button android:id="@+id/fun_exp" style="@style/PadButtonStyle.Advanced" android:layout_row="2" android:layout_column="0" android:contentDescription="@string/desc_fun_exp" android:text="@string/fun_exp" android:visibility="gone" /> <Button <Button android:id="@+id/fun_log" android:id="@+id/fun_log" style="@style/PadButtonStyle.Advanced" style="@style/PadButtonStyle.Advanced" Loading @@ -114,6 +123,15 @@ android:contentDescription="@string/desc_fun_log" android:contentDescription="@string/desc_fun_log" android:text="@string/fun_log" /> android:text="@string/fun_log" /> <Button android:id="@+id/fun_10pow" style="@style/PadButtonStyle.Advanced" android:layout_row="2" android:layout_column="1" android:contentDescription="@string/desc_fun_10pow" android:text="@string/fun_10pow" android:visibility="gone" /> <Button <Button android:id="@+id/op_fact" android:id="@+id/op_fact" style="@style/PadButtonStyle.Advanced" style="@style/PadButtonStyle.Advanced" Loading Loading @@ -170,4 +188,13 @@ android:contentDescription="@string/desc_op_sqrt" android:contentDescription="@string/desc_op_sqrt" android:text="@string/op_sqrt" /> android:text="@string/op_sqrt" /> <Button android:id="@+id/op_sqr" style="@style/PadButtonStyle.Advanced" android:layout_row="4" android:layout_column="2" android:contentDescription="@string/desc_op_sqr" android:text="@string/op_sqr" android:visibility="gone" /> </GridLayout> </GridLayout>
res/layout/pad_advanced_tablet_port.xml +27 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,15 @@ android:contentDescription="@string/desc_fun_ln" android:contentDescription="@string/desc_fun_ln" android:text="@string/fun_ln" /> android:text="@string/fun_ln" /> <Button android:id="@+id/fun_exp" style="@style/PadButtonStyle.Advanced" android:layout_row="1" android:layout_column="1" android:contentDescription="@string/desc_fun_exp" android:text="@string/fun_exp" android:visibility="gone" /> <Button <Button android:id="@+id/fun_log" android:id="@+id/fun_log" style="@style/PadButtonStyle.Advanced" style="@style/PadButtonStyle.Advanced" Loading @@ -114,6 +123,15 @@ android:contentDescription="@string/desc_fun_log" android:contentDescription="@string/desc_fun_log" android:text="@string/fun_log" /> android:text="@string/fun_log" /> <Button android:id="@+id/fun_10pow" style="@style/PadButtonStyle.Advanced" android:layout_row="1" android:layout_column="2" android:contentDescription="@string/desc_fun_10pow" android:text="@string/fun_10pow" android:visibility="gone" /> <Button <Button android:id="@+id/op_fact" android:id="@+id/op_fact" style="@style/PadButtonStyle.Advanced" style="@style/PadButtonStyle.Advanced" Loading Loading @@ -170,4 +188,13 @@ android:contentDescription="@string/desc_op_sqrt" android:contentDescription="@string/desc_op_sqrt" android:text="@string/op_sqrt" /> android:text="@string/op_sqrt" /> <Button android:id="@+id/op_sqr" style="@style/PadButtonStyle.Advanced" android:layout_row="2" android:layout_column="4" android:contentDescription="@string/desc_op_sqr" android:text="@string/op_sqr" android:visibility="gone" /> </GridLayout> </GridLayout>
res/values/strings.xml +27 −6 Original line number Original line Diff line number Diff line Loading @@ -78,23 +78,37 @@ <!-- Subtraction operator (e.g. "1 - 2"). [CHAR_LIMIT=1] --> <!-- Subtraction operator (e.g. "1 - 2"). [CHAR_LIMIT=1] --> <string name="op_sub" translatable="false">−</string> <string name="op_sub" translatable="false">−</string> <!-- Abbrev. name of cosine function (e.g. "cos(π)". [CHAR_LIMIT=4] --> <!-- Abbrev. name of cosine function (e.g. "cos(π)"). [CHAR_LIMIT=4] --> <string name="fun_cos" translatable="false">cos</string> <string name="fun_cos" translatable="false">cos</string> <!-- Natural logarithm function (e.g. "ln(2)"). [CHAR_LIMIT=4] --> <!-- Natural logarithm function (e.g. "ln(2)"). [CHAR_LIMIT=4] --> <string name="fun_ln" translatable="false">ln</string> <string name="fun_ln" translatable="false">ln</string> <!-- Logarithm function (e.g. "log(10)"). [CHAR_LIMIT=4] --> <!-- Logarithm function (e.g. "log(10)"). [CHAR_LIMIT=4] --> <string name="fun_log" translatable="false">log</string> <string name="fun_log" translatable="false">log</string> <!-- Abbrev. name of sine function (e.g. "sin(π)". [CHAR_LIMIT=4] --> <!-- Abbrev. name of sine function (e.g. "sin(π)"). [CHAR_LIMIT=4] --> <string name="fun_sin" translatable="false">sin</string> <string name="fun_sin" translatable="false">sin</string> <!-- Abbrev. name of tangent function (e.g. "tan(π)". [CHAR_LIMIT=4] --> <!-- Abbrev. name of tangent function (e.g. "tan(π)"). [CHAR_LIMIT=4] --> <string name="fun_tan" translatable="false">tan</string> <string name="fun_tan" translatable="false">tan</string> <!-- Abbrev. name of cosine function (e.g. "arccos(π)". [CHAR_LIMIT=5] --> <!-- Abbrev. name of cosine function (e.g. "arccos(π)"). [CHAR_LIMIT=5] --> <string name="fun_arccos" translatable="false">cos\u207B\u00B9</string> <string name="fun_arccos" translatable="false">cos\u207B\u00B9</string> <!-- Abbrev. name of sine function (e.g. "arcsin(π)". [CHAR_LIMIT=5] --> <!-- Abbrev. name of sine function (e.g. "arcsin(π)"). [CHAR_LIMIT=5] --> <string name="fun_arcsin" translatable="false">sin\u207B\u00B9</string> <string name="fun_arcsin" translatable="false">sin\u207B\u00B9</string> <!-- Abbrev. name of tangent function (e.g. "arctan(π)". [CHAR_LIMIT=5] --> <!-- Abbrev. name of tangent function (e.g. "arctan(π)"). [CHAR_LIMIT=5] --> <string name="fun_arctan" translatable="false">tan\u207B\u00B9</string> <string name="fun_arctan" translatable="false">tan\u207B\u00B9</string> <!-- Abbrev. name of base 10 exponential function (e.g. "10^6"). [CHAR_LIMIT=5] --> <string name="fun_10pow" translatable="false">10\u02E3</string> <!-- Abbrev. name of exponential function (e.g. "e^6"). [CHAR_LIMIT=5] --> <string name="fun_exp" translatable="false">e\u02E3</string> <!-- Abbrev. name of suffix square function on key (e.g. "17^2"). [CHAR_LIMIT=5] --> <string name="op_sqr" translatable="false">x\u00B2</string> <!-- Abbrev. name of suffix square function in formula. "^2" does not work, since it blends into a later constant. --> <string name="squared" translatable="false">²</string> <!-- Abbrev. name of exponential function in formula. --> <string name="exponential" translatable = "false">exp</string> <!-- Abbrev. name of degree mode [CHAR_LIMIT=4] --> <!-- Abbrev. name of degree mode [CHAR_LIMIT=4] --> <string name="mode_deg">deg</string> <string name="mode_deg">deg</string> <!-- Abbrev. name of radian mode. [CHAR_LIMIT=4] --> <!-- Abbrev. name of radian mode. [CHAR_LIMIT=4] --> Loading Loading @@ -139,6 +153,13 @@ <!-- Content description for 'arctan' button. [CHAR_LIMIT=NONE] --> <!-- Content description for 'arctan' button. [CHAR_LIMIT=NONE] --> <string name="desc_fun_arctan">inverse tangent</string> <string name="desc_fun_arctan">inverse tangent</string> <!-- Content description for 10^ button. [CHAR_LIMIT=NONE] --> <string name="desc_fun_10pow">ten to the power of</string> <!-- Content description for e^ button. [CHAR_LIMIT=NONE] --> <string name="desc_fun_exp">exponential function</string> <!-- Content description for ^2 button. [CHAR_LIMIT=NONE] --> <string name="desc_op_sqr">squared</string> <!-- Content description for '+' button. [CHAR_LIMIT=NONE] --> <!-- Content description for '+' button. [CHAR_LIMIT=NONE] --> <string name="desc_op_add">plus</string> <string name="desc_op_add">plus</string> <!-- Content description for '÷' button. [CHAR_LIMIT=NONE] --> <!-- Content description for '÷' button. [CHAR_LIMIT=NONE] --> Loading
src/com/android/calculator2/BoundedRational.java +13 −6 Original line number Original line Diff line number Diff line Loading @@ -229,6 +229,14 @@ public class BoundedRational { return null; return null; } } private static BoundedRational map0to1(BoundedRational r) { if (r == null) return null; if (r.mNum.equals(BigInteger.ZERO)) { return ONE; } return null; } private static BoundedRational map1to0(BoundedRational r) { private static BoundedRational map1to0(BoundedRational r) { if (r == null) return null; if (r == null) return null; if (r.mNum.equals(r.mDen)) { if (r.mNum.equals(r.mDen)) { Loading Loading @@ -345,12 +353,7 @@ public class BoundedRational { } } public static BoundedRational cos(BoundedRational r) { public static BoundedRational cos(BoundedRational r) { // Maps 0 to 1, null otherwise return map0to1(r); if (r == null) return null; if (r.mNum.equals(BigInteger.ZERO)) { return ONE; } return null; } } public static BoundedRational degreeCos(BoundedRational r) { public static BoundedRational degreeCos(BoundedRational r) { Loading Loading @@ -403,6 +406,10 @@ public class BoundedRational { return map1to0(r); return map1to0(r); } } public static BoundedRational exp(BoundedRational r) { return map0to1(r); } // Return the base 10 log of n, if n is a power of 10, -1 otherwise. // Return the base 10 log of n, if n is a power of 10, -1 otherwise. // n must be positive. // n must be positive. private static long b10Log(BigInteger n) { private static long b10Log(BigInteger n) { Loading