| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Change-Id: I6248f1edfa97b02c34604059f55454248dc1cc98
Signed-off-by: Bryan Owens <djbryan3540@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 22233200
Avoid repeatedly resetting text size to maximum, due to repeated
onMeasure calls.
Suppress text size change animation when the application is restarted.
Change-Id: Ic8b20deab2553176260051fa787416654bf0b3ef
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 24575798
Make factorial(0) return 1, as intended.
Add a few factorial tests.
Fix targetPackage spec so test is actually runnable again.
Change-Id: Ibb8d827f0325999c6b5ed49a939e1532ddf55639
(cherry picked from commit 6951591806f46405564a6cb868a88d0daf6764d2)
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Bug: 21470513
Prevent timeout message from disappearing on rotation.
Have long timeout setting survive rotation. Following Justin's
suggestion, associate it with a given expression and reset when
expression is cleared.
This does mean that when you rotate a device displaying an expensive-
-to-compute result, the device will initially display the formula for
several seconds, before it redisplays the result. Previously you
had to reenable the long timeout. Neither is 100% ideal.
Change-Id: Ibf8e151dd37ebadf1e86adee4718e8fa8f66b975
(cherry picked from commit 5e6a0ca2fcccb9ed16a465cf2a7e30ee5f7e0e67)
|
|\ \ \ |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Bug: 22931305
When the calculator is in result mode, cause a typed function name to
clear the display, just as touching the function on the screen would.
Change-Id: I77c69737a571ad8d2e6396fa3f34d5ada324fee4
(cherry picked from commit 5d79d10734b45133be7753955afd9e5edec58a1d)
|
|\ \ \ |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Bug: 22836179
Handle + or - operators specially if they are followed by a constant
or pre-evaluated expression and the % operator.
Since this is basically an idiomatic use of the operators, we
apply it very conservatively. When in doubt we use the old
interpretation.
Also fixes one unrelated anachronism in a comment.
Change-Id: I2f9fd26dd6c0456f0210815ef2bc1afca3a2b4d7
(cherry picked from commit 8afd0f85ed0b9fa1c96297c540cb74e6d8b9a64d)
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Bug: 23728152
This avoids the one case in which we displayed neither a decimal
point nor an exponent, and the decimal point was not just to the
right of the number.
Remove a redundant test, which obscured the logic.
Add a couple of suggested manual tests that helped me find a
(newly introduced, not submitted) bug.
Change-Id: Iead1efa0a4e8ea74512e9e1f77334f80bbcdd202
(cherry picked from commit 73ecff20d9dfd80d1cff09e0210d8987049b9df3)
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 22917707
Make a constant consisting of just a decimal point produce an error
when evaluated.
Change-Id: I970c8b396894f301553171dad3c325ffac09ff57
(cherry picked from commit fa5203c051fb5139c8fc678cae3997c8a7293c84)
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 23224425
Bug: 23695835
This adds a "cleared" announcement when last token/character is deleted.
Also change the existing "clear" announcements to "cleared".
Improve the comments for desc_clr and desc_del to address prior
misunderstandings.
Improve xml comment formatting consistency.
Change-Id: Ibe5197ceac132b73d72f8ace3982238249f5e82b
(cherry picked from commit db6f99979b713e491ace2f0cd9315e5c1616269b)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 24811759
Bug: 22047258
Add code to actively prevent ...99999 from getting turned back into
...00000 . This may have been imposssible anyway, but I couldn't
prove it.
Add tests for some Evaluator static functions, including the new
unflipZeroes().
Fix a minor bug in exponentEnd() discovered in the process.
The logic for limiting exponent length was wrong.
Remove some no longer needed code to force a reevaluation.
Generalize getPadding() function to repeat() and make it static.
Remove leadingZeroes() which is no longer used.
Make getMsdIndex() return the correct result even if it has changed
due to reevaluation.
Change-Id: Id457d8327ce0bc184d72ef78ddd3dbdaab7c6c78
(cherry picked from commit 7a432880b9d42b91a7069c6fb5398470f3cff19e)
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 24811759
Bug: 21469726
Bug: 23080519
Reformat to 100 columns. Reformat simple if-statements and rename
variables for better consistency with coding conventions.
Switch many comments to javadoc style.
Consistently use signum() to compare to zero. It's more concise and
probably slightly more efficient.
Change the asBigInteger implementation to use a single
divideAndRemainder call instead of relying on gcd. Add tests.
Eliminate redundant test in maybeReduce().
Change-Id: I4c275494e076612d09a05bc317c9972008619cda
(cherry picked from commit a4511f349124ca9cd2a7f9cb742be02b832a0206)
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 24811759
Bug: 21960281
Bug: 22047258
No substantive changes.
Reformat to 100 columns.
Correct and/or remove obsolete comments and occasional bits of clearly
dead code.
Better follow coding conventions.
Rename variables for both internal consistency and consistency with
other files. This included a few renamings in Calculator.java
and CalculatorResult.java, and a comment fix in CalculatorResult.java.
Rename public fields per coding convention. Correctly declare more
nested classes static.
Document FIXME issues to be addressed in followup CL. This includes
a careful look at the msd computations. I cannot construct any
failing examples, but I also cannot currently construct a correctness
argument.
Change-Id: I5c67493eeb7730edb4b3ca3ba1cb8b7d2b87dbc2
(cherry picked from commit abe2862bc936dd083b5ba19b68c68ea4cc44b2f6)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 22882700
We did not correctly calculate the extra space we might need to add
a decimal point to a scientific notation results. We also
incorrectly assumed that minus signs are the same width as a
digit. As a workaround we now reserve extra space for the possible
non-digit characters to ensure that a result is never inadvertently
truncated.
Change-Id: I79b499121703cd51bbbf3e1d85b2285a2dd5e025
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 21957088
Shorten timeouts.
We usually do short computations first, so this helps to avoid
starting absurdly big ones.
Check size of result before converting to decimal. If the decimal
conversion is likely to time out anyway, just pretent we timed out.
This turns out to avoid a lot of problems, since BigInteger decimal
conversion is the clear bottleneck for something like 100000!
And its uninterruptible.
Remove the timeout in one case in which we had previously forgotten.
Check for interrupts in a couple of more places in BoundedRational.
One of these caused log(10^100000) to hang for a long time.
One or two trivial cleanups in code that was touched anyway.
Change-Id: I3494a8ed28f681fb26634ecd90042e2f2a8008a8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 19190211
Bug: 19202945
Bug: 21052751
Bug: 19165054
Bug: 22594908
Add TtsSpans for operators that are otherwise misread by TalkBack.
Force correct reading for some individual characters.
This greatly improves Talkback for advanced operators in Calculator.
This is imperfect. There is no guarantee that the strings I'm
using will work in all languages. But they're almost certainly better than
what we have now. And it makes parentheses and factorial usable,
though perhaps a bit verbose.
We also no longer pronounce "sine" as "sin".
Removed some now obsolete TODO comments.
Change-Id: I5236f682be828699e08dca04ee6fa073269964f6
|
|
|
|
|
|
|
|
|
|
| |
Bug: 22481292
This could result in display of an old result.
Factor out code to start a result evaluation.
Change-Id: I651d4386323c0abd7a86176b386072093345a1b1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 21470972
Support pasting of numbers using scientific notation with 'E'. This
is intentionally very restricted to dodge ambiguities with the
constant e. We only accept a scientific notation constant if it is
1) Contained within a single pasted text element.
2) Uses capital 'E' to introduce the exponent.
3) Does not contain an explicit '+' in the exponent.
We do currently use the same notion of 'digit' as elsewhere, i.e.
Character.isDigit(), which might be too general.
For consistency, and to make sure that we can recognize machine
generated output, this also adds a few more aliases for text input
of arithmetic operators.
For consistency, always use 'E' internally for scientific notation as
well.
We ensure that a pasted numeric string is not concatenated with
a pre-existing constant. This is a judgment call, but it means
that pasting a previous calculator result gets similar treatment
whether or not we are still running the same calculator instance.
We support limited editing on exponents. Once an exponent is deleted,
the only way to restore it is via pasting. The 10^x button
produces similar results, though with different operator precedence
behavior.
Change-Id: I2d0f3dceb641cdad327fd3c3540b5eea38030146
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 21048155
Bug: 19189356
Incrementally announce additions to the formula.
Explicitly announce result after hitting equals.
Announce when display is cleared.
Remove old FIXME comment after a bit more testing.
Change-Id: I836ff6672de3f891888b2724470290c8721d4fcf
|
|/
|
|
|
|
|
|
|
|
| |
Bug: 22208425
Most of the mathematical operators/symbols (e.g. "π") cannot be encoded
using "ISO-8859-1" however they still should be aligned using the
default capital letter height ("H").
Change-Id: I4ca6674de6e6a96b0ce513ecd8acea775f2e7081
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 20650813
This preserves fraction and "with leading digits" displays during
rotation.
It also turns out to easily support copy, which is a useful bonus,
since it was an obvious hole in the UI for the fraction display.
For the "with leading digits" display, this is similar to a
plain display copy, but it allows character-level selection.
Much of the code here was cloned from Justin's.
Change-Id: I4805280fa6a46f06833be0bde9563c3ce04dca45
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 246391
Only ignore trailing BINARY operators when computing instant results.
We used to be much more aggressive.
Also ignore trailing binary operators when the user hits "=".
This makes us consistent with the L design and ensures that instant
results don't turn into errors when the user hits "=".
Change-Id: I260e95d152168b70774330ac95d5bc567cf79b3d
|
|
|
|
|
|
|
|
|
| |
Bug: 20667245
Update calculator code to reflect the fact that CR Errors have
become exceptions, and they are now delcared local to CR.
Change-Id: Ie9c9e10cef2f98a23856aa9e49328ae7ba52c9bc
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 21471857
Bug: 20819212
End rather than cancel() in-progress animation in the event of user
interaction.
Discard input that interrupted a computation only for delete,
and clear, where it seems to make sense.
Use similar interruption logic for physical keyboard input as for
touch.
Make integer exponentiation more interruptible. This remains
imperfect; the latencies in a single BigInteger multiplication
can be high. Filed b/21957088 to track that.
Clear "instant" result before launching reevaluation. Otherwise the
example from b/21957088 shows incorrect instant results for an
uncomfortably long time as it's being entered.
Correct some of the state maintenance operations in Calculator.java.
The ANIMATE state was not being used correctly.
Remove redundant cancelAll() and onCancelled() calls.
Add an option to cancel without a message. Use it for clear.
Change-Id: Ibab90dca0cb894e7985642f212ff41030f2fc52d
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 22041219
Restore default scrolling position when hitting enter after scrolling
an instant display result.
We could instead preserve the position and fix the display logic to
no longer get confused by a non-default initial position. But this
feels more natural to me.
Change-Id: I43bb936b5bb1b5af7a7befb90fdfc0f745fb7729
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 21986868
Bug: 21960281
Fix and restructure the formatting and scroll-limit-calculation
code. This code is inherently tricky, and has had more bugs than
we would like to admit to. Use the opportunity to clean up the
code a bit, renaming variables consistently.
The good news is that the code seems to be getting slightly
simpler with each bug fix.
This fixes several separate off-by-one errors related to result
formatting:
The expLen() exponent string length calculation was off by 1
for exact powers of 10.
The dropDigits calculation in the formatting code was off for
negative exponents just shorter than an exact power of 10.
The exponent space calculation for a few results like -1.2*10^-8
was off by one.
For a result like -10^-500 we did not reserve space for the leading
minus sign, since that's not computed until after scrolling.
[Less serious] The ellipses were omitted when we had just barely
scrolled a leading minus sign off the screen. (This only occurred
in exactly one position, which could never be the default one.)
Change-Id: If1bfbbb70a624998be3d996592d129b16aade745
|
|/
|
|
|
| |
Bug: 21756459
Change-Id: Id8889c8a1f7cda255de2eeebedfbdc1fad7634b1
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 21759654
Previously the number of displayed digits didn't quite match the
number of digits in the normal display, and results with positive
exponents always came out as inexact. This fixes both.
Remove an obsolete FIXME comment.
Change-Id: I9aa0217d7804218c54fe929e59dfbc6bbf880db7
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 20503008
Correctly provide content position information to the ActionMode so
that menues can be better positioned.
Highlight a result that's about to be copied.
Ensure that the end of the current formula becomes visible when
the paste menu appears.
Change-Id: I318985776e59175b827d5089c0ca4978f3a658cb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 21495243
This changes the behavior to be much more compatible with L.
We generally do not allow consecutive binary operators to be inserted.
In the case of a minus operator however, the logic is more complicated.
We do allow a minus after multiplication, division and power.
When the minus is explicitly entered, so the user sees our corrections,
we do not allow a minus after additive operators. In pasted text,
we do.
We no longer reject additions that would result in implicit
multiplications. We do immediately reject binary operators in leading
contexts, e.g. after a left parenthesis, in which they must result in
a syntax error.
Change-Id: I1d35d74335371f6f113808d68a4f293b699d9bd0
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 21921280
Also some general refactoring of CalculatorText.
Change-Id: If10f7329f1bfb4c2967c1c85f160efe6d3d1390c
|
|/
|
|
|
|
|
|
|
| |
Bug: 21789679
Also adds some tests for digitsRequired(), including one that fails
without this CL.
Change-Id: Ib007e753f90c019c37666d71c1cfd02301dcd360
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 21497671
Fix mChangedValue handling, so that it is only reset after an actual
evaluation, and is set when an expression is "collapsed".
Consistently produce instant results for solitary pre-evaluated
expressions if and only if they involve an abbreviation.
Change-Id: I4e1f824e2353cbe78b1827f3930c72666832cff4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 21474616
Rewrite getShortString() to also look at the least significant digit
information when available, and try to mimic the display formatting
code wherever appropriate. As a result, when the user hits "=",
followed by "+" transitions are now more frequently smooth.
Revise the evaluation heuristics so the we are more aggressive
with the initial evaluation precision, and try harder to discover
the leading digit in a near-zero number. Some of this is necessary
to keep getShortString() happy. This version should also now
guarantee that we are never worse than double precision floating
pointing in displaying very small nonzero numbers. If we display
a number as zero, the old calculator would have, too. (And now
you can scroll to see whether it really is.)
Up the BoundedRational bit limit to improve the chances of identifying
exact results.
In general, the incremental computation cost for operating on
larger BigIntegers appears relatively low, so it makes sense to
trade longer computations for fewer calls.
Change-Id: I33066845b832753c109fcaf27f883b48e7e119d2
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bug: 21405924
Bug: 21529236
Bug: 21534231
This limits the display of trailing zeroes to the case in which
they avoid the need for scientic notation, and to the case of
results we did not identify as rational. This means that you
can use scrolling as an indicator of whether there may be more
digits.
The old code exhibited some misbehavior around this, the most
serious of which was probably the second bug listed above.
This now uses scientific notation more aggressively for small
numbers (b/21534231).
This patch unfortunately needs to deal with many odd corner cases
to make sure that we stop scrolling at just the right point, before
the first trailing zero appears, even if there are exponents
involved. I tested as many corner cases as I could think of.
And the testing exposed other preexisting bugs.
I do not know of a good way to avoid this without reverting
to the old scroll-through-trailing-zeroes behavior.
This significantly changes the behavior on e.g.
10^30 (Previously allowed scrolling to the decimal point, now is
unscrollable.)
10^-20 (Weird initial display with trailing zeroes; which could not
be reproduced after scrolling.)
It turns out that formatResult() scientific notation formatting
could accidentally extend the input result by 1 or 2 characters.
Based on my testing, the one character case was actually a feature:
Since there was a decimal point in the result the extra ellipsis
space seems to always give us plenty of room. The two character
case whoever sometimes resulted in wrapping, and is fixed here.
The one character case is now official. Ideally we should check
that we actually have enough space; currently I just assume a
single additional character.
Disallow scrolling left of the default position. This seems
more consistent with TextView scrolling and eliminates some
crufty code.
Fixed an off-by-one error in getPreferredPrec, which resulted in
positive results that were one character too short.
Change-Id: I13657377d098055def99e7a173f71f40d361fe3c
|
| |
| |
| |
| |
| | |
Bug: 21706513
Change-Id: I4646cd1d9a2d67e6e8241ecbb5b960b440c458d2
|
| |
| |
| |
| |
| |
| | |
Bug: 20497138
Bug: 20648856
Change-Id: Id71e2c1922447957b61e3c06b205f991f01eea27
|
|/
|
|
|
|
|
|
|
|
|
|
| |
Bug: 18908042
- Hide the descendents of the non-current pad using the
IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS flag.
- Intercept touch events that may be sent to the non-current pad.
- Allow DPAD key events to be handled by the formula TextView so that
it can be scrolled using a hardware keyboard.
Change-Id: Ib92c72f939a6b7469eed060adcc5cefdcfc98666
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug: 21493470
Add x^2 10^x and e^x functions, to make the recently added INV key
work as expected.
Implement % functionality.
10^x is essentially just macro expansions for now.
% and x^2 need trivial evaluator support to provide reasonable display
syntax.
We decided to add evaluator support for exp() as well.
Add corresponding exp() support to BoundedRational and its tests.
Tiny incidental changes for problems uncovered in the process:
Fix bug in tests/README.txt
Evaluate the constant e only once.
Add one more power test along with the exp() test.
Fix proguard.flags so BRTest runs again.
Change-Id: I26cfcaf6d99aeec11387297cc5586e2ddcab6add
|