Improve logic for evaluation/animation interruption

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
3 files changed