From eb85d0e0df9cdb9c89d3d7e560f1239e662f5713 Mon Sep 17 00:00:00 2001 From: "Igor B. Poretsky" Date: Thu, 31 Mar 2016 23:36:25 +0300 Subject: [PATCH] Improved application mode switch accessibility by proper filling contentDescription field of its elements. --- .../src/net/osmand/plus/activities/actions/AppModeDialog.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java b/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java index 4783142d6a..9beed11c0c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java +++ b/OsmAnd/src/net/osmand/plus/activities/actions/AppModeDialog.java @@ -76,6 +76,7 @@ public class AppModeDialog { ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon); if (checked) { 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); } else { if (useMapTheme) { @@ -85,6 +86,7 @@ public class AppModeDialog { } else { 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); } 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 metricsY = (int) ctx.getResources().getDimension(R.dimen.map_mode_button_width); 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); 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); LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY); // lp.setMargins(left, 0, 0, 0);