diff options
author | Sean Stout <sstout@google.com> | 2016-07-01 11:19:36 -0700 |
---|---|---|
committer | Sean Stout <sstout@google.com> | 2016-07-01 13:16:43 -0700 |
commit | 1131e0a2e6d0d0e4cfacdf7fe56e20db04313e4f (patch) | |
tree | 53fa383f85195a457a349dcd346ed31b0af642ae /src/com/android/deskclock/timer/TimerSetupView.java | |
parent | 8b58c72608a8b89c0dcdbc7066e70ab1c41e3983 (diff) |
Talkback for new timer now sounds good
Bug: 29939321
When reading back the time being set, Talkback will
now sound like a veritable human being.
Change-Id: I5eb17d305a80295d5a3051ee25b252ae912baaf1
Diffstat (limited to 'src/com/android/deskclock/timer/TimerSetupView.java')
-rw-r--r-- | src/com/android/deskclock/timer/TimerSetupView.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/com/android/deskclock/timer/TimerSetupView.java b/src/com/android/deskclock/timer/TimerSetupView.java index c3b240ca5..78363659d 100644 --- a/src/com/android/deskclock/timer/TimerSetupView.java +++ b/src/com/android/deskclock/timer/TimerSetupView.java @@ -262,7 +262,10 @@ public class TimerSetupView extends LinearLayout implements Button.OnClickListen private void updateTime() { final int seconds = mInput[1] * 10 + mInput[0]; + final int minutes = mInput[3] * 10 + mInput[2]; + final int hours = mInput[5] * 10 + mInput[4]; mEnteredTime.setTime(mInput[5], mInput[4], mInput[3], mInput[2], seconds); + mEnteredTime.setContentDescription(createContentDescription(hours, minutes, seconds)); } private void updateDeleteButtonAndDivider() { @@ -274,4 +277,17 @@ public class TimerSetupView extends LinearLayout implements Button.OnClickListen private void updateFab() { mFabContainer.updateFab(FAB_ONLY_SHRINK_AND_EXPAND); } + + private CharSequence createContentDescription(int hours, int minutes, int seconds) { + final Resources r = getResources(); + final String hoursFormatted = r.getQuantityString( + R.plurals.Nhours_description, hours, hours); + final String minutesFormatted = r.getQuantityString( + R.plurals.Nminutes_description, minutes, minutes); + final String secondsFormatted = r.getQuantityString( + R.plurals.Nseconds_description, seconds, seconds); + return (hours == 0 ? "" : hoursFormatted + ", ") + + (minutes == 0 ? "" : minutesFormatted + ", ") + + secondsFormatted; + } } |