Show toolbar when DEG/RAD mode matters
Bug: 27926287
Bug: 28086262
Continue to show the toolbar when entering a formula containing trig
function calls.
This also changes the toolbar hiding logic a bit to make physical
keyboard input more like button presses.
No longer makes the tool bar visible on a long press, reserving
that for COPY or PASTE.
Change-Id: I30cb3d747e45b8fe24e35b20805a1d04bdf7b8c9
diff --git a/src/com/android/calculator2/CalculatorExpr.java b/src/com/android/calculator2/CalculatorExpr.java
index 2946b8b..764b054 100644
--- a/src/com/android/calculator2/CalculatorExpr.java
+++ b/src/com/android/calculator2/CalculatorExpr.java
@@ -979,6 +979,21 @@
}
/**
+ * Does the expression contain trig operations?
+ */
+ public boolean hasTrigFuncs() {
+ for (Token t: mExpr) {
+ if (t instanceof Operator) {
+ Operator o = (Operator)t;
+ if (KeyMaps.isTrigFunc(o.id)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
* Evaluate the expression excluding trailing binary operators.
* Errors result in exceptions, most of which are unchecked. Should not be called
* concurrently with modification of the expression. May take a very long time; avoid calling