Improved accessibility by providing content description for widgets.
This commit is contained in:
parent
ee3b5aab21
commit
6ea8d82000
9 changed files with 39 additions and 12 deletions
|
@ -3,7 +3,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:keepScreenOn="true">
|
||||
<net.osmand.plus.views.OsmandMapTileView android:id="@+id/MapView" android:layout_width="fill_parent" android:layout_height="fill_parent"/>
|
||||
<net.osmand.plus.views.OsmandMapTileView android:id="@+id/MapView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:contentDescription="@string/map_view"/>
|
||||
|
||||
<LinearLayout android:layout_width="wrap_content" android:id="@+id/RouteLayout" android:orientation="horizontal" android:layout_height="wrap_content" android:layout_gravity="bottom|center" android:layout_marginBottom="12dp">
|
||||
<Button android:contentDescription="@string/previous_button" android:layout_width="wrap_content" android:id="@+id/PreviousButton" android:layout_height="wrap_content" android:background="@android:drawable/ic_media_previous"/>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:keepScreenOn="true" android:clipChildren="false">
|
||||
<net.osmand.plus.views.OsmandMapTileView android:id="@+id/MapView" android:layout_width="fill_parent" android:layout_height="fill_parent"/>
|
||||
<net.osmand.plus.views.OsmandMapTileView android:id="@+id/MapView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:contentDescription="@string/map_view"/>
|
||||
|
||||
<LinearLayout android:layout_width="wrap_content" android:id="@+id/RouteLayout" android:orientation="horizontal" android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp" android:layout_gravity="bottom|center" >
|
||||
|
|
|
@ -1126,4 +1126,7 @@
|
|||
<string name="prefer_in_routing_title">Предпочитать…</string>
|
||||
<string name="prefer_in_routing_descr">Предпочитать автомагистрали</string>
|
||||
<string name="tip_recent_changes_1_2_t">"Изменения в 1.2: "</string>
|
||||
</resources>
|
||||
<string name="item_checked">отмечено</string>
|
||||
<string name="item_unchecked">не отмечено</string>
|
||||
<string name="map_view">Карта</string>
|
||||
</resources>
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="item_checked">checked</string>
|
||||
<string name="item_unchecked">unchecked</string>
|
||||
<string name="map_view">Map</string>
|
||||
<string name="prefer_motorways">Prefer motorways</string>
|
||||
<string name="prefer_in_routing_title">Prefer…</string>
|
||||
<string name="prefer_in_routing_descr">Prefer motorways</string>
|
||||
|
|
|
@ -83,6 +83,7 @@ public class PluginsActivity extends OsmandListActivity {
|
|||
TextView nameView = (TextView) row.findViewById(R.id.plugin_name);
|
||||
nameView.setText(plugin.getName());
|
||||
nameView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.list_activities_plugin_menu_symbol), null, getResources().getDrawable(resourceId), null);
|
||||
nameView.setContentDescription(plugin.getName() + " " + getString(toBeEnabled ? R.string.item_checked : R.string.item_unchecked));
|
||||
|
||||
TextView description = (TextView) row.findViewById(R.id.plugin_descr);
|
||||
description.setText(plugin.getDescription());
|
||||
|
|
|
@ -15,6 +15,8 @@ public abstract class MapInfoControl extends View implements MapControlUpdateabl
|
|||
Rect padding = new Rect();
|
||||
int shadowColor = Color.WHITE;
|
||||
|
||||
private String contentTitle;
|
||||
|
||||
public MapInfoControl(Context ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
|
@ -25,6 +27,17 @@ public abstract class MapInfoControl extends View implements MapControlUpdateabl
|
|||
super.setBackgroundDrawable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentDescription(CharSequence text) {
|
||||
if (contentTitle != null)
|
||||
super.setContentDescription(contentTitle + " " + text); //$NON-NLS-1$
|
||||
else super.setContentDescription(text);
|
||||
}
|
||||
|
||||
public void setContentTitle(String text) {
|
||||
contentTitle = text;
|
||||
super.setContentDescription(text);
|
||||
}
|
||||
|
||||
public void setWDimensions(int w, int h){
|
||||
setMeasuredDimension(w + padding.left + padding.right, h + padding.top + padding.bottom);
|
||||
|
|
|
@ -133,6 +133,8 @@ public class MapInfoControls {
|
|||
ii.visibleModes.add(ms);
|
||||
}
|
||||
}
|
||||
if (m != null)
|
||||
m.setContentDescription(m.getContext().getString(messageId));
|
||||
ii.drawable = drawable;
|
||||
ii.messageId = messageId;
|
||||
ii.m = m;
|
||||
|
@ -174,6 +176,8 @@ public class MapInfoControls {
|
|||
ii.visibleCollapsible.add(ms);
|
||||
}
|
||||
}
|
||||
if (m != null)
|
||||
m.setContentTitle(m.getContext().getString(messageId));
|
||||
ii.drawable = drawable;
|
||||
ii.messageId = messageId;
|
||||
ii.m = m;
|
||||
|
|
|
@ -732,22 +732,16 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
ImageView configuration = new ImageView(map);
|
||||
Drawable drawable = view.getResources().getDrawable(R.drawable.widget_config);
|
||||
configuration.setBackgroundDrawable(drawable);
|
||||
configuration.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openViewConfigureDialog();
|
||||
}
|
||||
});
|
||||
fl.addView(configuration, fparams);
|
||||
fparams = new FrameLayout.LayoutParams(drawable.getMinimumWidth(), drawable.getMinimumHeight());
|
||||
progressBar = new View(view.getContext());
|
||||
progressBar.setOnClickListener(new View.OnClickListener() {
|
||||
fl.addView(progressBar, fparams);
|
||||
fl.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openViewConfigureDialog();
|
||||
}
|
||||
});
|
||||
fl.addView(progressBar, fparams);
|
||||
return fl;
|
||||
}
|
||||
private View createGlobus(){
|
||||
|
@ -943,8 +937,10 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
text += "..";
|
||||
}
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, pp.getTextSize());
|
||||
setContentDescription(text);
|
||||
} else {
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, 7);
|
||||
setContentDescription(getResources().getString(R.string.map_widget_top_text));
|
||||
}
|
||||
setText(text);
|
||||
invalidate();
|
||||
|
|
|
@ -43,6 +43,13 @@ public class TextInfoControl extends MapInfoControl {
|
|||
public void setText(String text, String subtext) {
|
||||
this.text = text;
|
||||
this.subtext = subtext;
|
||||
if (text != null) {
|
||||
if (subtext != null)
|
||||
setContentDescription(text + " " + subtext); //$NON-NLS-1$
|
||||
else setContentDescription(text);
|
||||
} else {
|
||||
setContentDescription(subtext);
|
||||
}
|
||||
updateVisibility(text != null);
|
||||
requestLayout();
|
||||
invalidate();
|
||||
|
|
Loading…
Reference in a new issue