Fixing issue where toasts were getting queued. (Bug 6572269)

Change-Id: Iceb27c4c5a4168beb5a5ae37a0c597e1940bff04
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index d55260c..80fc62f 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -300,6 +300,8 @@
     PendingAddWidgetInfo mCreateWidgetInfo = null;
     private boolean mDraggingWidget = false;
 
+    private Toast mWidgetInstructionToast;
+
     // Deferral of loading widget previews during launcher transitions
     private boolean mInTransition;
     private ArrayList<AsyncTaskPageData> mDeferredSyncWidgetPageItems =
@@ -577,8 +579,12 @@
 
         } else if (v instanceof PagedViewWidget) {
             // Let the user know that they have to long press to add a widget
-            Toast.makeText(getContext(), R.string.long_press_widget_to_add,
-                    Toast.LENGTH_SHORT).show();
+            if (mWidgetInstructionToast != null) {
+                mWidgetInstructionToast.cancel();
+            }
+            mWidgetInstructionToast = Toast.makeText(getContext(),R.string.long_press_widget_to_add,
+                Toast.LENGTH_SHORT);
+            mWidgetInstructionToast.show();
 
             // Create a little animation to show that the widget can move
             float offsetY = getResources().getDimensionPixelSize(R.dimen.dragViewOffsetY);