Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Accessibility for Android apps

Paula Rosa
September 14, 2021

Accessibility for Android apps

Paula Rosa

September 14, 2021
Tweet

More Decks by Paula Rosa

Other Decks in Technology

Transcript

  1. MOBILE ACCESSIBILITY Accessibility is the ability to provide to all

    users the equivalent experience, considering each user’s disabilities
  2. MOBILE ACCESSIBILITY • From home to subway station (with or

    without help ) • Ask someone’s help from the subway station • From the subway station to the bank (with or without help ) • Wait in the lin e • Ask the attendant to transfer the mone y • From bank to the subway station (with or without help ) • Ask someone’s help in the statio n • From the subway to home (with or without help ) • From the subway to home (with or without help) • Open the ap p • Login the app (if needed ) • Go to transfe r • Fill the correct informatio n • Make the transfe r • Share receipt (if needed) Transfer money - App without accessibility Transfer money - App with accessibility
  3. MOBILE ACCESSIBILITY But more important, as developer you can bring

    to the accessibility users: • Freedo m • Independency • Increase capabilities
  4. ACCESSIBILITY FEATURES * All features are located in the user’s

    settings Color correction Talkback Switch access Brailleback Magnification Voice access
  5. TALKBACK • It’s the feature that requires more attention from

    the developer s • It navigate for each element emitting an audio: “state + text + component type ” • “Connect” + “Button ” • “On” + “shortcut Settings” + switch
  6. HOW THE TALKBACK WORKS • Each component is announced by

    the talkback (when it’s touched or focused ) • The user map the screen (memorising the component’s layout ) • After mapping it, he/she decides what action is going to take 2 actions : - Notice the wal l - Take another direction
  7. TALKBACK GESTURES Read the component 2x Click Swipe Focus change

    Back button Context menu Home screen Recent Apps Noti fi cations
  8. LABELLING DECORATIVE IMAGES android:importantForAcessibility="no" (API >= 16) <ImageView android:id=“@+id/reminder_icon” android:layout_width="wrap_content"

    android:layout_height="wrap_content" android:src="@drawable/ic_app" android:layout_gravity="center" android:layout_marginTop="40dp" android:contentDescription="@null" />
  9. ACCESSIBILITY IN EXECUTION TIME • Polite: Waits to talkback fi

    nish the audio that is executin g • Assertive: Interrupt the playing audi o • None: none of the other one s ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE);
  10. ACCESSIBILITY FOR CUSTOM VIEWS Views inherit from views with accessibility

    CustomView Views that do not inherit accessibility views - onDraw() - onMeasure() When the methods are overridden Inherit from the View class
  11. ACCESSIBILITY FOR CUSTOM VIEWS @Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {

    event.getText().add(“some text”); return true; } Implement the methods: • onPopulateAccessibilityEvent( ) • dispatchPopulateAccessibilityEvent() - child view s • onInitializeAccessibilityEvent( ) • onInitializeAccessibilityNodeInfo (Service ) Events : • TYPE_VIEW_CLICKE D • TYPE_VIEW_LONG_CLICKE D • TYPE_VIEW_FOCUSE D • TYPE_VIEW_SCROLLE D • TYPE_VIEW_HOVER_ENTE R • TYPE_VIEW_HOVER_EXIT
  12. ACCESSIBILITY FOR CUSTOM VIEWS Virtual Views • Used when you

    want to provide views details in a single vie w • Use the Accessibility Service and AccessibilityNodeProvider to work with virtual views
  13. ACCESSIBILITY SCANNER What can recognise : • Images description s

    • Duplicated description s • Text constras t • Cannot recognise everythin g • Android 6.0 +
  14. TESTING ACCESSIBILITY BY WRITING TESTS onView(withId(R.id.ic_app_notificacao)).check (matches(not(hasContentDescription()))); Test if the

    component has (or not) the content description onView(withId(R.id.botao_twitter)).check (matches(withContentDescription(“Login with twitter account”))); Check the component description
  15. ACCESSIBILITY TIPS • Be careful with banners (because they can

    steal the focus ) • Be careful with components transparency • Explore vibration (that is under explored in mobile apps) • Pay more attention to the multi-state component s • It’s a good practice to integrate voice commands to the app s
  16. ACCESSIBILITY FOR TUTORIALS It’s better to use solid screens tutorials

    instead of the transparency ones . Because the transparency allows the accessibility to focus in the components bellow the desired objects. Incorrect Correct
  17. USEFUL LINKS • https://developer.android.com/guide/topics/ui/accessibility/index.htm l • https://codelabs.developers.google.com/codelabs/basic-android-accessibility / • http://www.slideshare.net/KellyShuster/android-accessibility-droidcon-londo

    n • http://www.slideshare.net/7mary4/android-accessibility-3999545 6 • https://www.youtube.com/watch?v=euEsfNR5Zw4 (io 2015 ) • https://www.youtube.com/watch?v=Ce7q_cu8mvo (io 2021 ) • https://www.youtube.com/watch?v=apEz73_H2fU (Voice Access)