Improved application mode switch accessibility by proper filling
contentDescription field of its elements.
This commit is contained in:
parent
ce3c6fb34d
commit
eb85d0e0df
1 changed files with 3 additions and 1 deletions
|
@ -76,6 +76,7 @@ public class AppModeDialog {
|
||||||
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
||||||
if (checked) {
|
if (checked) {
|
||||||
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange));
|
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange));
|
||||||
|
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
|
||||||
tb.findViewById(R.id.selection).setVisibility(View.VISIBLE);
|
tb.findViewById(R.id.selection).setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
if (useMapTheme) {
|
if (useMapTheme) {
|
||||||
|
@ -85,6 +86,7 @@ public class AppModeDialog {
|
||||||
} else {
|
} else {
|
||||||
iv.setImageDrawable(ctx.getIconsCache().getThemedIcon(mode.getSmallIconDark()));
|
iv.setImageDrawable(ctx.getIconsCache().getThemedIcon(mode.getSmallIconDark()));
|
||||||
}
|
}
|
||||||
|
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_unchecked)));
|
||||||
tb.findViewById(R.id.selection).setVisibility(View.INVISIBLE);
|
tb.findViewById(R.id.selection).setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
iv.setOnClickListener(new View.OnClickListener() {
|
iv.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -120,9 +122,9 @@ public class AppModeDialog {
|
||||||
int metricsX = (int) ctx.getResources().getDimension(R.dimen.map_mode_button_width);
|
int metricsX = (int) ctx.getResources().getDimension(R.dimen.map_mode_button_width);
|
||||||
int metricsY = (int) ctx.getResources().getDimension(R.dimen.map_mode_button_width);
|
int metricsY = (int) ctx.getResources().getDimension(R.dimen.map_mode_button_width);
|
||||||
View tb = layoutInflater.inflate(R.layout.mode_view, null);
|
View tb = layoutInflater.inflate(R.layout.mode_view, null);
|
||||||
tb.findViewById(R.id.app_mode_icon).setContentDescription(mode.toHumanString(ctx));
|
|
||||||
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
||||||
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange));
|
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange));
|
||||||
|
iv.setContentDescription(mode.toHumanString(ctx));
|
||||||
// tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null);
|
// tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null);
|
||||||
LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY);
|
LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY);
|
||||||
// lp.setMargins(left, 0, 0, 0);
|
// lp.setMargins(left, 0, 0, 0);
|
||||||
|
|
Loading…
Reference in a new issue