From 89f40defb824cf2749a634244db00bc5d55bdf99 Mon Sep 17 00:00:00 2001 From: Anita W <1918555+anitawoodruff@users.noreply.github.com> Date: Mon, 4 May 2020 16:27:29 +0100 Subject: [PATCH] Talkback improvements for New Habit and New Daily screens (#1317) * Include state in content description of positive/negative habit buttons - Now instead of announcing just 'Positive' or 'Negative' when these buttons are focused with Talkback on, it also announces their current state (e.g. 'Positive On'). - Also, when the state is changed, it now sends an accessibility event so the new state is announced immediately (as advised at https://developer.android.com/guide/topics/ui/accessibility/custom-views#send-events). * Make headings in Task Form be read out as headings by Talkback * Include state in content description of task difficulty buttons - Now instead of announcing just 'Trivial', 'Medium' etc when these buttons are focused with Talkback on, it also announces their current state (e.g. 'Medium, Selected' / 'Trivial, Not Selected'). - Also, when a difficulty button is clicked, it now sends an accessibility event for the button corresponding to that difficulty level, so the new state is announced immediately. - Note that since buttons are recreated every time one is clicked, we can't simply send the event from the button's OnClickListener. Instead we have to record which button is selected and send the event for that button once it has been recreated. * Include state in content description of reset streak buttons - Now instead of announcing just 'Daily', 'Weekly' etc when these buttons are focused with Talkback on, it also announces their current state (e.g. 'Daily, Selected' / 'Weekly, Not Selected'). - Also, when a reset streak button is clicked, it now sends an accessibility event with the new content description, so the new state is announced immediately. - Note that since buttons are recreated every time one is clicked, we can't simply send the event from the button's OnClickListener. Instead we have to record which button is selected and send the event for that button once it has been recreated. * Add labelFor attributes for repeats_every_spinner/edittext - This adds more context for the drop-down menu and the edit-text content descriptions read out by Talkback when editing how often dailies repeat. This is advised by the accessibility principle described at https://developer.android.com/guide/topics/ui/accessibility/principles#content-pairs - For example instead of reading out 'Drop-down menu, Weekly' it now reads out 'Drop-down menu, Weekly, for Repeats'. And instead of reading out '1, Edit box' it now reads out '1, Edit box for Weeks'. * Improve content descriptions of weekday buttons on New Daily screen - Now instead of 'Capital M', 'Capital T', etc. Talkback reads out 'Monday, Selected', 'Tuesday, Not selected', etc. - It also reads out the new status whenever a day is selected or deselected. * Mini refactor: reduce duplication in configureMonthlyRepeatViews * Improve content description of weekly repeats buttons - Now the content descriptions of the weekly repeats buttons in the New Daily screen include whether they are Selected / Not selected. - Also an accessibility event is sent when they are toggled, so the content description is read out again with the updated status. * Improve content descriptions of ReminderItemFormView - Previously, the '+' button was focusable, even though it didn't do anything, and Talkback read out 'Unlabelled button', regardless of whether it was a '+' button or a 'x' button. - Now, we only make it focusable when it becomes a delete button, and Talkback reads out 'Delete Reminder, Button for 6.16pm' (or whatever the time of the reminder it relates to is - this is achieved by setting the android:labelFor property on the reminder TextView). * Improve content descriptions of ChecklistItemFormView - Previously, the '+' button was focusable, even though it didn't do anything, and Talkback read out 'Unlabelled button', regardless of whether it was a '+' button or a 'x' button. - Now, we only make it focusable when it becomes a delete button, and Talkback reads out 'Delete Checklist Entry, Button for Checklist Text' (or whatever the checklist text is - this is achieved by setting the android:labelFor property on the checklist EditText). --- .../res/layout/task_form_task_scheduling.xml | 8 ++-- Habitica/res/values/strings.xml | 6 +++ Habitica/res/values/styles.xml | 1 + .../views/tasks/form/ChecklistItemFormView.kt | 9 ++++ .../tasks/form/HabitResetStreakButtons.kt | 24 ++++++++++- .../tasks/form/HabitScoringButtonsView.kt | 15 ++++++- .../views/tasks/form/ReminderItemFormView.kt | 9 ++++ .../views/tasks/form/TaskDifficultyButtons.kt | 19 ++++++++- .../tasks/form/TaskSchedulingControls.kt | 41 +++++++++++++------ 9 files changed, 112 insertions(+), 20 deletions(-) diff --git a/Habitica/res/layout/task_form_task_scheduling.xml b/Habitica/res/layout/task_form_task_scheduling.xml index f97c08c25..f16663c4f 100644 --- a/Habitica/res/layout/task_form_task_scheduling.xml +++ b/Habitica/res/layout/task_form_task_scheduling.xml @@ -60,7 +60,8 @@ android:layout_height="wrap_content" android:text="@string/repeats" android:textColor="@color/gray_300" - android:textSize="12sp" /> + android:textSize="12sp" + android:labelFor="@+id/repeats_every_spinner"/> + android:text="@string/days" + android:textColor="@color/gray_300" + android:labelFor="@+id/repeats_every_edittext"/> diff --git a/Habitica/res/values/strings.xml b/Habitica/res/values/strings.xml index 60c915f7b..2d7cd7ce3 100644 --- a/Habitica/res/values/strings.xml +++ b/Habitica/res/values/strings.xml @@ -86,6 +86,10 @@ Start Date Positive Negative + On + Off + Selected + Not selected Checklist Reminders @@ -821,6 +825,7 @@ Invite to Party Are you sure? Delete Task + Delete Reminder Not right now Choose a class that fits your playstyle and unlock special skills and armor to help you on your journey Class System unlocked! @@ -1009,4 +1014,5 @@ Read More You are unable to buy that amount. Still have a question? + Delete Checklist entry diff --git a/Habitica/res/values/styles.xml b/Habitica/res/values/styles.xml index 344639979..60c0d0409 100644 --- a/Habitica/res/values/styles.xml +++ b/Habitica/res/values/styles.xml @@ -636,6 +636,7 @@ @color/gray_10 @dimen/spacing_large @dimen/spacing_medium + true