astuetz / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
139 stars 44 forks source link

IconTabProvider needs to be accessible #96

Open nordfalk opened 10 years ago

nordfalk commented 10 years ago

When a visually impaired person is using the TalkBack function to explore an UI using PagerSlidingTabStrop with an IconTabProvider he just hears 'Unmarked button 143', 'Unmarked button 186', etc as you add ImageButtons without a contentDescription.

You need to do something like:

  private void addIconTab(final int position, int resId, String contentDescription) {
    ImageButton tab = new ImageButton(getContext());
    tab.setContentDescription(contentDescription);
    tab.setImageResource(resId);
    addTab(position, tab);
  }

to make it usable for blind persons.

I suggest you redefine

  public interface IconTabProvider {
    public int getPageIconResId(int position);
    public String getPageContentDescription(int position);
  }

Here is a diff of how I did the change: http://code.google.com/p/dr-radio-android/source/diff?spec=svn439&r=439&format=side&path=/trunk/DRRadiov3/src/dk/dr/radio/diverse/PagerSlidingTabStrip.java

This is really important for visually impaired people. Please contribute to making Andoid apps usable by visually impaired people by making this change.

nordfalk commented 10 years ago

Ah, I see I'm not the only one :-) https://github.com/imlunacat/PagerSlidingTabStrip/commit/db91d18436b9734de1e24c9086c46dce44ae3b30