Set the widget preview title a11y text to "{widget name} widget"
Fix: 187376680 Test: Manual Change-Id: I211d8e2b437091808d1f5a764075af4c3832ef48
This commit is contained in:
parent
bf60673bbb
commit
85486d1c2c
|
@ -55,6 +55,9 @@
|
||||||
<string name="widget_dims_format">%1$d \u00d7 %2$d</string>
|
<string name="widget_dims_format">%1$d \u00d7 %2$d</string>
|
||||||
<!-- Accessibility spoken message format for the dimensions of a widget in the drawer -->
|
<!-- Accessibility spoken message format for the dimensions of a widget in the drawer -->
|
||||||
<string name="widget_accessible_dims_format">%1$d wide by %2$d high</string>
|
<string name="widget_accessible_dims_format">%1$d wide by %2$d high</string>
|
||||||
|
<!-- Spoken text for a screen reader. The placeholder text is the widget name.
|
||||||
|
[CHAR_LIMIT=none]-->
|
||||||
|
<string name="widget_preview_context_description"><xliff:g id="widget_name" example="Calendar month view">%1$s</xliff:g> widget</string>
|
||||||
<!-- Message to tell the user to press and hold a widget/icon to add it to the home screen.
|
<!-- Message to tell the user to press and hold a widget/icon to add it to the home screen.
|
||||||
[CHAR LIMIT=NONE] -->
|
[CHAR LIMIT=NONE] -->
|
||||||
<string name="add_item_request_drag_hint">Touch & hold the widget to move it around the Home screen</string>
|
<string name="add_item_request_drag_hint">Touch & hold the widget to move it around the Home screen</string>
|
||||||
|
|
|
@ -180,14 +180,17 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||||
public void applyFromCellItem(WidgetItem item, WidgetPreviewLoader loader) {
|
public void applyFromCellItem(WidgetItem item, WidgetPreviewLoader loader) {
|
||||||
applyPreviewOnAppWidgetHostView(item);
|
applyPreviewOnAppWidgetHostView(item);
|
||||||
|
|
||||||
|
Context context = getContext();
|
||||||
mItem = item;
|
mItem = item;
|
||||||
mWidgetName.setText(mItem.label);
|
mWidgetName.setText(mItem.label);
|
||||||
mWidgetDims.setText(getContext().getString(R.string.widget_dims_format,
|
mWidgetName.setContentDescription(
|
||||||
|
context.getString(R.string.widget_preview_context_description, mItem.label));
|
||||||
|
mWidgetDims.setText(context.getString(R.string.widget_dims_format,
|
||||||
mItem.spanX, mItem.spanY));
|
mItem.spanX, mItem.spanY));
|
||||||
mWidgetDims.setContentDescription(getContext().getString(
|
mWidgetDims.setContentDescription(context.getString(
|
||||||
R.string.widget_accessible_dims_format, mItem.spanX, mItem.spanY));
|
R.string.widget_accessible_dims_format, mItem.spanX, mItem.spanY));
|
||||||
if (ATLEAST_S && mItem.widgetInfo != null) {
|
if (ATLEAST_S && mItem.widgetInfo != null) {
|
||||||
CharSequence description = mItem.widgetInfo.loadDescription(getContext());
|
CharSequence description = mItem.widgetInfo.loadDescription(context);
|
||||||
if (description != null && description.length() > 0) {
|
if (description != null && description.length() > 0) {
|
||||||
mWidgetDescription.setText(description);
|
mWidgetDescription.setText(description);
|
||||||
mWidgetDescription.setVisibility(VISIBLE);
|
mWidgetDescription.setVisibility(VISIBLE);
|
||||||
|
@ -238,6 +241,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||||
NavigableAppWidgetHostView appWidgetHostViewPreview,
|
NavigableAppWidgetHostView appWidgetHostViewPreview,
|
||||||
LauncherAppWidgetProviderInfo providerInfo,
|
LauncherAppWidgetProviderInfo providerInfo,
|
||||||
@Nullable RemoteViews remoteViews) {
|
@Nullable RemoteViews remoteViews) {
|
||||||
|
appWidgetHostViewPreview.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||||
appWidgetHostViewPreview.setAppWidget(/* appWidgetId= */ -1, providerInfo);
|
appWidgetHostViewPreview.setAppWidget(/* appWidgetId= */ -1, providerInfo);
|
||||||
Rect padding;
|
Rect padding;
|
||||||
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
||||||
|
|
Loading…
Reference in New Issue