aricneto / TwistyTimer

Twisty Timer is a material design twisty puzzle timer for Android. It uses the TNoodle library to generate scramble sequences for all current official speedsolving puzzles.
GNU General Public License v3.0
242 stars 54 forks source link

Improved behaviour of time display while holding or if deleted. #41

Closed damo closed 8 years ago

damo commented 8 years ago

If a solve time is deleted, the time displayed is reset to zero, rather than continuing to display the time that was just deleted. If a best or worst time was recorded, the "congratulations" text is also hidden.

If hold-for-start is enabled and inspection is not enabled and the timer is "held down", it will display "0.00" in readiness for the new solve, not the time of the previous solve. This avoids the disconcerting case where the timer that is about to start is showing something like "56.78", which makes it seem like the timer will start from there. However, if the hold is too short, the "0.00" is cleared and the original time (of the previous solve) is restored.

The logic for this is mostly in the "ChronometerMilli" class. The code in "TimerFragment" that changed the highlight color of the timer text was also moved into "ChronometerMilli" behind a simple "setHighlighted" method. The two colors are then supplied from the layout XML.

Other code instantiating various handlers, runnables and countdown timers is now guarded with conditions that only instantiates these objects if they will be used.

The "onTouch" code for the timer has been simplified by extracting some simple methods, eliminating redundant logic and other similar measures.