NIU Tooltip : tooltip overlap issue fix
Overlay is getting updated multiple times, So If a tooltip is getting
shown then next overlay update call will trigger new tooltip regardless of current tooltip behavior.
If a tooltip is getting shown then other tooltips should not be triggered. Added a check for this.
Bug: 194458724
Test: Local build and run on Pixel 4a
Change-Id: I5266ddd7cfa84258b46dc14846d77872752ac442
(cherry picked from commit ced47f4ae652987f746daeec2367d184b1d63937)
diff --git a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
index 91cab3c..c91137e 100644
--- a/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
+++ b/go/quickstep/src/com/android/quickstep/TaskOverlayFactoryGo.java
@@ -53,6 +53,7 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.views.ArrowTipView;
import com.android.quickstep.util.AssistContentRequester;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.views.GoOverviewActionsView;
@@ -117,6 +118,7 @@
private AssistContentRequester mFactoryContentRequester;
private SharedPreferences mSharedPreferences;
private OverlayDialogGo mDialog;
+ private ArrowTipView mArrowTipView;
private TaskOverlayGo(TaskThumbnailView taskThumbnailView,
AssistContentRequester assistContentRequester) {
@@ -382,11 +384,14 @@
* Order of tooltips are translate and then listen
*/
private void showTooltipsIfUnseen() {
+ if (mArrowTipView != null && mArrowTipView.isOpen()) {
+ return;
+ }
if (!mSharedPreferences.getBoolean(TRANSLATE_TOOL_TIP_SEEN, false)) {
- ((GoOverviewActionsView) getActionsView()).showTranslateToolTip();
+ mArrowTipView = ((GoOverviewActionsView) getActionsView()).showTranslateToolTip();
mSharedPreferences.edit().putBoolean(TRANSLATE_TOOL_TIP_SEEN, true).apply();
} else if (!mSharedPreferences.getBoolean(LISTEN_TOOL_TIP_SEEN, false)) {
- ((GoOverviewActionsView) getActionsView()).showListenToolTip();
+ mArrowTipView = ((GoOverviewActionsView) getActionsView()).showListenToolTip();
mSharedPreferences.edit().putBoolean(LISTEN_TOOL_TIP_SEEN, true).apply();
}
}
diff --git a/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java b/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java
index 97ba590..6e2e6cb 100644
--- a/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/GoOverviewActionsView.java
@@ -84,7 +84,7 @@
/**
* Shows Tooltip for action icons
*/
- private void showToolTip(int viewId, int textResourceId) {
+ private ArrowTipView showToolTip(int viewId, int textResourceId) {
int[] location = new int[2];
@Px int topMargin = getResources().getDimensionPixelSize(R.dimen.tooltip_top_margin);
findViewById(viewId).getLocationOnScreen(location);
@@ -94,21 +94,22 @@
/* yCoord= */ location[1] - topMargin);
mArrowTipView.bringToFront();
+ return mArrowTipView;
}
/**
* Shows Tooltip for listen action icon
*/
- public void showListenToolTip() {
- showToolTip(/* viewId= */ R.id.action_listen,
+ public ArrowTipView showListenToolTip() {
+ return showToolTip(/* viewId= */ R.id.action_listen,
/* textResourceId= */ R.string.tooltip_listen);
}
/**
* Shows Tooltip for translate action icon
*/
- public void showTranslateToolTip() {
- showToolTip(/* viewId= */ R.id.action_translate,
+ public ArrowTipView showTranslateToolTip() {
+ return showToolTip(/* viewId= */ R.id.action_translate,
/* textResourceId= */ R.string.tooltip_translate);
}