Avoid Math.sqrt() in ShakeDetector

Given both `magnitude` and `ACCELERATION_THRESHOLD` are positive, the following are equivalent:

    magnitude > ACCELERATION_THRESHOLD

    magnitude * magnitude > ACCELERATION_THRESHOLD * ACCELERATION_THRESHOLD

The second one is more efficient.