Show instruction toast when user taps on drag handle.

Bug: 74369785
Change-Id: I7017266efcb0db70a8d151eed10442292cb61e70
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0b45b8e..7d5d81c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -72,6 +72,11 @@
     <string name="notifications_header">Notifications</string>
 
     <!-- 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 &amp; hold to pick up 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=100] -->
+    <string name="long_accessible_way_to_add_shortcut">Double-tap &amp; hold to pick up a shortcut or use custom actions.</string>
+
     <skip />
     <!-- Error message when user has filled a home screen -->
     <string name="out_of_space">No more room on this Home screen.</string>
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutTextView.java b/src/com/android/launcher3/shortcuts/DeepShortcutTextView.java
index 1a5297d..c809f27 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutTextView.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutTextView.java
@@ -22,6 +22,7 @@
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
+import android.widget.Toast;
 
 import com.android.launcher3.BubbleTextView;
 import com.android.launcher3.R;
@@ -33,7 +34,9 @@
 public class DeepShortcutTextView extends BubbleTextView {
     private final Rect mDragHandleBounds = new Rect();
     private final int mDragHandleWidth;
-    private boolean mShouldPerformClick = true;
+    private boolean mShowInstructionToast = false;
+
+    private Toast mInstructionToast;
 
     public DeepShortcutTextView(Context context) {
         this(context, null, 0);
@@ -70,14 +73,29 @@
     @Override
     public boolean onTouchEvent(MotionEvent ev) {
         if (ev.getAction() == MotionEvent.ACTION_DOWN) {
-            // Ignore clicks on the drag handle (long clicks still start the drag).
-            mShouldPerformClick = !mDragHandleBounds.contains((int) ev.getX(), (int) ev.getY());
+            // Show toast if user touches the drag handle (long clicks still start the drag).
+            mShowInstructionToast = mDragHandleBounds.contains((int) ev.getX(), (int) ev.getY());
         }
         return super.onTouchEvent(ev);
     }
 
     @Override
     public boolean performClick() {
-        return mShouldPerformClick && super.performClick();
+        if (mShowInstructionToast) {
+            showToast();
+            return true;
+        }
+        return super.performClick();
+    }
+
+    private void showToast() {
+        if (mInstructionToast != null) {
+            mInstructionToast.cancel();
+        }
+        CharSequence msg = Utilities.wrapForTts(
+                getContext().getText(R.string.long_press_shortcut_to_add),
+                getContext().getString(R.string.long_accessible_way_to_add_shortcut));
+        mInstructionToast = Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT);
+        mInstructionToast.show();
     }
 }