Android Programming The Big Nerd Ranch Guide by Bill Phillips, Chris Stewart, Kristin Marsicano (z-lib.org)

(gtxtreme123) #1

Challenge: Improving the List


Challenge: Improving the List


On the crime list screen, TalkBack reads the title and date of each item. However, it does not indicate
whether the crime is solved. Fix this problem by giving the handcuff icon a content description.


Note that the readout is a bit lengthy, given the date format, and the solved status is read at the very
end – or not at all, if the crime is not solved. To take this challenge one step further, instead of adding a
content description on the icon in XML, add a dynamic content description to each visible item in the
recycler view. In the description, summarize the data the user sees in the row.


Challenge: Providing Enough Context for Data Entry


The date button and CHOOSE SUSPECT button both suffer from a similar problem as your original
title EditText: Users, whether using TalkBack or not, are not explicitly told what the button with the
date on it is for. Similarly, once users select a contact as the suspect, they are no longer told or shown
what the button represents. Users can probably infer the meaning of the buttons and the text on those
buttons, but should they have to?


This is one of the nuances of UI design. It is up to you (or your design team) to figure out what makes
the most sense for your application – to balance simplicity of the interface with ease of use.


For this challenge, update the implementation of the details screen so that users do not lose context
about what the data they have chosen means. This could be as simple as adding labels for each field,
as you did for the title EditText. Or it could be more involved; perhaps you want to rework the details
screen altogether. The choice is yours. Go forth and make your app more accessible so everyone can
enjoy ratting out misbehaving coworkers.


Challenge: Announcing Events


By adding dynamic content descriptions to the crime scene photo ImageView, you improved the crime
scene photo experience. But the onus is on the TalkBack user to press on the ImageView to check its
status. A sighted user has the benefit of seeing the image change (or not) when returning from the
camera app.


You can provide a similar experience via TalkBack by announcing what happened as a result of
the camera app closing. Read up on the View.announceForAccessibility(...) method in the
documentation and use it in CriminalIntent at the appropriate time.


You might consider making the announcement in onActivityResult(...). If you do, there will be some
timing issues related to the activity lifecycle. You can get around these by delaying the announcement
for a small amount of time by posting a Runnable (which you will learn more about in Chapter 26). It
might look something like this:

Free download pdf