Contextually filled contentDescription field of the plugin list item

related buttons.
This commit is contained in:
Igor B. Poretsky 2016-03-31 23:22:12 +03:00
parent e7360127bf
commit 6eca1ca255
4 changed files with 6 additions and 0 deletions

View file

@ -1989,4 +1989,5 @@
<string name="access_sort">Сортировать</string> <string name="access_sort">Сортировать</string>
<string name="access_shared_string_navigate_up">Перейти вверх</string> <string name="access_shared_string_navigate_up">Перейти вверх</string>
<string name="access_widget_expand">Развернуть</string> <string name="access_widget_expand">Развернуть</string>
<string name="access_shared_string_not_installed">Не установлен</string>
</resources> </resources>

View file

@ -10,6 +10,7 @@
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy 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="access_shared_string_not_installed">Not installed</string>
<string name="access_widget_expand">Expand</string> <string name="access_widget_expand">Expand</string>
<string name="access_shared_string_navigate_up">Navigate up</string> <string name="access_shared_string_navigate_up">Navigate up</string>
<string name="access_sort">Sort</string> <string name="access_sort">Sort</string>

View file

@ -94,10 +94,12 @@ public class PluginsActivity extends OsmandListActivity {
pluginLogo.setImageResource(plugin.getLogoResourceId()); pluginLogo.setImageResource(plugin.getLogoResourceId());
if (plugin.isActive()) { if (plugin.isActive()) {
pluginLogo.setBackgroundResource(R.drawable.bg_plugin_logo_enabled); pluginLogo.setBackgroundResource(R.drawable.bg_plugin_logo_enabled);
pluginLogo.setContentDescription(getString(R.string.shared_string_disable));
} else { } else {
TypedArray attributes = getTheme().obtainStyledAttributes( TypedArray attributes = getTheme().obtainStyledAttributes(
new int[] {R.attr.bg_plugin_logo_disabled}); new int[] {R.attr.bg_plugin_logo_disabled});
pluginLogo.setBackgroundDrawable(attributes.getDrawable(0)); pluginLogo.setBackgroundDrawable(attributes.getDrawable(0));
pluginLogo.setContentDescription(getString(plugin.needsInstallation() ? R.string.access_shared_string_not_installed : R.string.shared_string_enable));
attributes.recycle(); attributes.recycle();
} }
pluginLogo.setOnClickListener(new View.OnClickListener() { pluginLogo.setOnClickListener(new View.OnClickListener() {

View file

@ -130,10 +130,12 @@ public class DashPluginsFragment extends DashBaseFragment {
ImageButton logoView = (ImageButton) pluginView.findViewById(R.id.plugin_logo); ImageButton logoView = (ImageButton) pluginView.findViewById(R.id.plugin_logo);
if (plugin.isActive()) { if (plugin.isActive()) {
logoView.setBackgroundResource(R.drawable.bg_plugin_logo_enabled); logoView.setBackgroundResource(R.drawable.bg_plugin_logo_enabled);
logoView.setContentDescription(getString(R.string.shared_string_disable));
} else { } else {
TypedArray attributes = getActivity().getTheme().obtainStyledAttributes( TypedArray attributes = getActivity().getTheme().obtainStyledAttributes(
new int[]{R.attr.bg_plugin_logo_disabled}); new int[]{R.attr.bg_plugin_logo_disabled});
logoView.setBackgroundDrawable(attributes.getDrawable(0)); logoView.setBackgroundDrawable(attributes.getDrawable(0));
logoView.setContentDescription(getString(plugin.needsInstallation() ? R.string.access_shared_string_not_installed : R.string.shared_string_enable));
attributes.recycle(); attributes.recycle();
} }
} }