Update widget toast strings
Test: Tap on widgets and shortcuts in all widget tray and observe correct string is shown. Bug: 179797520 Change-Id: I0e274017d4af1de506afbb819ab91f6575d7bb8e
This commit is contained in:
parent
3c08f580c3
commit
7ec893fb8e
|
@ -40,9 +40,9 @@
|
|||
|
||||
<!-- Widgets -->
|
||||
<!-- Message to tell the user to press and hold on a widget to add it [CHAR_LIMIT=50] -->
|
||||
<string name="long_press_widget_to_add">Touch & hold to pick up a widget.</string>
|
||||
<string name="long_press_widget_to_add">Touch & hold to move a widget.</string>
|
||||
<!-- Accessibility spoken hint message in widget picker, which allows user to add a widget. Custom action is the label for additional accessibility actions available in this mode [CHAR_LIMIT=100] -->
|
||||
<string name="long_accessible_way_to_add">Double-tap & hold to pick up a widget or use custom actions.</string>
|
||||
<string name="long_accessible_way_to_add">Double-tap & hold to move a widget or use custom actions.</string>
|
||||
<!-- The format string for the dimensions of a widget in the drawer -->
|
||||
<!-- There is a special version of this format string for Farsi -->
|
||||
<string name="widget_dims_format">%1$d \u00d7 %2$d</string>
|
||||
|
@ -101,9 +101,9 @@
|
|||
|
||||
<!-- Drag and drop -->
|
||||
<!-- Message to tell the user to press and hold on a shortcut to add it [CHAR_LIMIT=50] -->
|
||||
<string name="long_press_shortcut_to_add">Touch & hold to pick up a shortcut.</string>
|
||||
<string name="long_press_shortcut_to_add">Touch & hold to move a shortcut.</string>
|
||||
<!-- Accessibility spoken hint message in deep shortcut menu, which allows user to add a shortcut. Custom action is the label for additional accessibility actions available in this mode [CHAR_LIMIT=200] -->
|
||||
<string name="long_accessible_way_to_add_shortcut">Double-tap & hold to pick up a shortcut or use custom actions.</string>
|
||||
<string name="long_accessible_way_to_add_shortcut">Double-tap & hold to move a shortcut or use custom actions.</string>
|
||||
|
||||
<skip />
|
||||
<!-- Error message when user has filled a home screen -->
|
||||
|
|
|
@ -74,7 +74,18 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView
|
|||
|
||||
@Override
|
||||
public final void onClick(View v) {
|
||||
mWidgetInstructionToast = showWidgetToast(getContext(), mWidgetInstructionToast);
|
||||
Object tag = null;
|
||||
if (v instanceof WidgetCell) {
|
||||
tag = v.getTag();
|
||||
} else if (v.getParent() instanceof WidgetCell) {
|
||||
tag = ((WidgetCell) v.getParent()).getTag();
|
||||
}
|
||||
if (tag instanceof PendingAddShortcutInfo) {
|
||||
mWidgetInstructionToast = showShortcutToast(getContext(), mWidgetInstructionToast);
|
||||
} else {
|
||||
mWidgetInstructionToast = showWidgetToast(getContext(), mWidgetInstructionToast);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -158,4 +169,21 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView
|
|||
toast.show();
|
||||
return toast;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show shortcut tap toast prompting user to drag instead.
|
||||
*/
|
||||
private static Toast showShortcutToast(Context context, Toast toast) {
|
||||
// Let the user know that they have to long press to add a widget
|
||||
if (toast != null) {
|
||||
toast.cancel();
|
||||
}
|
||||
|
||||
CharSequence msg = Utilities.wrapForTts(
|
||||
context.getText(R.string.long_press_shortcut_to_add),
|
||||
context.getString(R.string.long_accessible_way_to_add_shortcut));
|
||||
toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
return toast;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue