Adds content descriptions and hints to non-textual elements so they can be described by screen readers.
This commit is contained in:
parent
4ea04bb576
commit
f6a165a50a
12 changed files with 91 additions and 63 deletions
|
@ -289,6 +289,16 @@ public class AccountActivity extends BaseActivity {
|
|||
updateButtons();
|
||||
}
|
||||
|
||||
private void updateFollowButton(FloatingActionButton button) {
|
||||
if (following) {
|
||||
button.setImageResource(R.drawable.ic_person_minus_24px);
|
||||
button.setContentDescription(getString(R.string.action_unfollow));
|
||||
} else {
|
||||
button.setImageResource(R.drawable.ic_person_add_24dp);
|
||||
button.setContentDescription(getString(R.string.action_follow));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateButtons() {
|
||||
invalidateOptionsMenu();
|
||||
|
||||
|
@ -297,24 +307,13 @@ public class AccountActivity extends BaseActivity {
|
|||
if(!isSelf && !blocking) {
|
||||
floatingBtn.show();
|
||||
|
||||
if (following) {
|
||||
floatingBtn.setImageResource(R.drawable.ic_person_minus_24px);
|
||||
} else {
|
||||
floatingBtn.setImageResource(R.drawable.ic_person_add_24dp);
|
||||
}
|
||||
updateFollowButton(floatingBtn);
|
||||
|
||||
floatingBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
follow(accountId);
|
||||
|
||||
if (following) {
|
||||
floatingBtn.setImageResource(R.drawable.ic_person_minus_24px);
|
||||
} else {
|
||||
floatingBtn.setImageResource(R.drawable.ic_person_add_24dp);
|
||||
}
|
||||
|
||||
updateFollowButton(floatingBtn);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue