Add more education tips for widgets. (3/3)

Show tip on reconfigurable widget in launcher.

Bug: 185354491
Test: Manually tested tips in widget picker, all apps, and
reconfigurable widgets tip.

Change-Id: I08154c944285cac6a21c3ef4aafd878bbbccf44b
This commit is contained in:
Alina Zaidi
2021-06-07 10:27:23 +01:00
parent 14e1f2a6bb
commit ecdf6575ec
7 changed files with 83 additions and 29 deletions

View File

@@ -207,16 +207,18 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
if (view == null || !ViewCompat.isLaidOut(view)) {
return null;
}
mActivityContext.getSharedPrefs().edit()
.putBoolean(KEY_WIDGETS_EDUCATION_TIP_SEEN, true).apply();
int[] coords = new int[2];
view.getLocationOnScreen(coords);
ArrowTipView arrowTipView = new ArrowTipView(mActivityContext);
return arrowTipView.showAtLocation(
getContext().getString(R.string.long_press_widget_to_add),
/* arrowXCoord= */coords[0] + view.getWidth() / 2,
/* yCoord= */coords[1]);
ArrowTipView arrowTipView =
new ArrowTipView(mActivityContext, /* isPointingUp= */ false).showAtLocation(
getContext().getString(R.string.long_press_widget_to_add),
/* arrowXCoord= */coords[0] + view.getWidth() / 2,
/* yCoord= */coords[1]);
if (arrowTipView != null) {
mActivityContext.getSharedPrefs().edit()
.putBoolean(KEY_WIDGETS_EDUCATION_TIP_SEEN, true).apply();
}
return arrowTipView;
}
/** Returns {@code true} if tip has previously been shown on any of {@link BaseWidgetSheet}. */