Adding accessibility controls

> Adding 'Remove' option to workspace items
> Adding 'Add to workspace' to all apps and widget list items, which
adds the item to the first available space, giving preference to
the current workspace screen
> Adding 'App info' and 'Uninstall' options to appropriate items

Bug: 18482913
Change-Id: Ifab7423af2d9ba502b5a2771b37bb5436b3df937
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 07f3045..f9255e6 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -49,7 +49,15 @@
     private static final int SHADOW_SMALL_COLOUR = 0xCC000000;
     static final float PADDING_V = 3.0f;
 
-    private HolographicOutlineHelper mOutlineHelper;
+
+    private final Drawable mBackground;
+    private final CheckLongPressHelper mLongPressHelper;
+    private final HolographicOutlineHelper mOutlineHelper;
+
+    // TODO: Remove custom background handling code, as no instance of BubbleTextView use any
+    // background.
+    private boolean mBackgroundSizeChanged;
+
     private Bitmap mPressedBackground;
 
     private float mSlop;
@@ -58,14 +66,8 @@
     private final boolean mCustomShadowsEnabled;
     private boolean mIsTextVisible;
 
-    // TODO: Remove custom background handling code, as no instance of BubbleTextView use any
-    // background.
-    private boolean mBackgroundSizeChanged;
-    private final Drawable mBackground;
-
     private boolean mStayPressed;
     private boolean mIgnorePressedStateChange;
-    private CheckLongPressHelper mLongPressHelper;
 
     public BubbleTextView(Context context) {
         this(context, null, 0);
@@ -90,7 +92,14 @@
         } else {
             mBackground = null;
         }
-        init();
+        mLongPressHelper = new CheckLongPressHelper(this);
+
+        mOutlineHelper = HolographicOutlineHelper.obtain(getContext());
+        if (mCustomShadowsEnabled) {
+            setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
+        }
+
+        setAccessibilityDelegate(LauncherAppState.getInstance().getAccessibilityDelegate());
     }
 
     public void onFinishInflate() {
@@ -102,15 +111,6 @@
         setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
     }
 
-    private void init() {
-        mLongPressHelper = new CheckLongPressHelper(this);
-
-        mOutlineHelper = HolographicOutlineHelper.obtain(getContext());
-        if (mCustomShadowsEnabled) {
-            setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
-        }
-    }
-
     public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache,
             boolean setDefaultPadding) {
         applyFromShortcutInfo(info, iconCache, setDefaultPadding, false);
@@ -328,7 +328,7 @@
         Drawable top = getCompoundDrawables()[1];
 
         if (top instanceof PreloadIconDrawable) {
-            ((PreloadIconDrawable) top).applyTheme(getPreloaderTheme());
+            ((PreloadIconDrawable) top).applyPreloaderTheme(getPreloaderTheme());
         }
         mSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
     }