Altering touch feedback for qsb assets. (Bug: 5560273)

- Removing some dead code

Change-Id: If6f3ffcf28249ca08c23089acb5bcd501b455119
diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java
index 9f27586..32b1de4 100644
--- a/src/com/android/launcher2/Cling.java
+++ b/src/com/android/launcher2/Cling.java
@@ -28,7 +28,6 @@
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.util.DisplayMetrics;
-import android.view.View;
 import android.widget.FrameLayout;
 
 import com.android.launcher.R;
@@ -54,8 +53,6 @@
     private Drawable mHandTouchGraphic;
     private int mPunchThroughGraphicCenterRadius;
     private int mAppIconSize;
-    private int mTabBarHeight;
-    private int mTabBarHorizontalPadding;
     private int mButtonBarHeight;
     private float mRevealRadius;
     private int[] mPositionData;
@@ -89,9 +86,6 @@
                 r.getDimensionPixelSize(R.dimen.clingPunchThroughGraphicCenterRadius);
             mAppIconSize = r.getDimensionPixelSize(R.dimen.app_icon_size);
             mRevealRadius = mAppIconSize * 1f;
-            mTabBarHeight = r.getDimensionPixelSize(R.dimen.apps_customize_tab_bar_height);
-            mTabBarHorizontalPadding =
-                r.getDimensionPixelSize(R.dimen.toolbar_button_horizontal_padding);
             mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height);
 
             mErasePaint = new Paint();
diff --git a/src/com/android/launcher2/HolographicLinearLayout.java b/src/com/android/launcher2/HolographicLinearLayout.java
index 986a063..c6a8d6a 100644
--- a/src/com/android/launcher2/HolographicLinearLayout.java
+++ b/src/com/android/launcher2/HolographicLinearLayout.java
@@ -17,13 +17,21 @@
 package com.android.launcher2;
 
 import android.content.Context;
+import android.content.res.TypedArray;
 import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.StateListDrawable;
 import android.util.AttributeSet;
+import android.widget.ImageView;
 import android.widget.LinearLayout;
 
+import com.android.launcher.R;
+
 public class HolographicLinearLayout extends LinearLayout {
 
     private final HolographicViewHelper mHolographicHelper;
+    private ImageView mImageView;
+    private int mImageViewId;
 
     public HolographicLinearLayout(Context context) {
         this(context, null);
@@ -36,16 +44,37 @@
     public HolographicLinearLayout(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
 
+        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HolographicLinearLayout,
+                defStyle, 0);
+        mImageViewId = a.getResourceId(R.styleable.HolographicLinearLayout_sourceImageViewId, -1);
+        a.recycle();
+
         setWillNotDraw(false);
         mHolographicHelper = new HolographicViewHelper(context);
     }
 
     @Override
+    protected void drawableStateChanged() {
+        super.drawableStateChanged();
+
+        if (mImageView != null) {
+            Drawable d = mImageView.getDrawable();
+            if (d instanceof StateListDrawable) {
+                StateListDrawable sld = (StateListDrawable) d;
+                sld.setState(getDrawableState());
+            }
+        }
+    }
+
+    @Override
     protected void onDraw(Canvas canvas) {
         super.onDraw(canvas);
 
         // One time call to generate the pressed/focused state -- must be called after
         // measure/layout
-        mHolographicHelper.generatePressedFocusedStates(this);
+        if (mImageView == null) {
+            mImageView = (ImageView) findViewById(mImageViewId);
+        }
+        mHolographicHelper.generatePressedFocusedStates(mImageView);
     }
 }
diff --git a/src/com/android/launcher2/HolographicViewHelper.java b/src/com/android/launcher2/HolographicViewHelper.java
index c68a5ea..11e81b4 100644
--- a/src/com/android/launcher2/HolographicViewHelper.java
+++ b/src/com/android/launcher2/HolographicViewHelper.java
@@ -20,12 +20,12 @@
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
+import android.graphics.PorterDuff;
 import android.graphics.drawable.StateListDrawable;
-import android.view.View;
+import android.widget.ImageView;
 
 public class HolographicViewHelper {
 
-    private final HolographicOutlineHelper mOutlineHelper = new HolographicOutlineHelper();
     private final Canvas mTempCanvas = new Canvas();
 
     private boolean mStatesUpdated;
@@ -39,16 +39,17 @@
     /**
      * Generate the pressed/focused states if necessary.
      */
-    void generatePressedFocusedStates(View v) {
-        if (!mStatesUpdated) {
+    void generatePressedFocusedStates(ImageView v) {
+        if (!mStatesUpdated && v != null) {
             mStatesUpdated = true;
-            Bitmap outline = createGlowingOutline(v, mTempCanvas, mHighlightColor, mHighlightColor);
+            Bitmap outline = createGlowingOutline(v, mTempCanvas);
             FastBitmapDrawable d = new FastBitmapDrawable(outline);
 
             StateListDrawable states = new StateListDrawable();
             states.addState(new int[] {android.R.attr.state_pressed}, d);
             states.addState(new int[] {android.R.attr.state_focused}, d);
-            v.setBackgroundDrawable(states);
+            states.addState(new int[] {}, v.getDrawable());
+            v.setImageDrawable(states);
         }
     }
 
@@ -56,16 +57,16 @@
      * Returns a new bitmap to be used as the object outline, e.g. to visualize the drop location.
      * Responsibility for the bitmap is transferred to the caller.
      */
-    private Bitmap createGlowingOutline(View v, Canvas canvas, int outlineColor, int glowColor) {
+    private Bitmap createGlowingOutline(ImageView v, Canvas canvas) {
         final int padding = HolographicOutlineHelper.MAX_OUTER_BLUR_RADIUS;
         final Bitmap b = Bitmap.createBitmap(
                 v.getWidth() + padding, v.getHeight() + padding, Bitmap.Config.ARGB_8888);
 
         canvas.setBitmap(b);
         canvas.save();
-            v.draw(canvas);
+            v.getDrawable().draw(canvas);
         canvas.restore();
-        mOutlineHelper.applyOuterBlur(b, canvas, outlineColor);
+        canvas.drawColor(mHighlightColor, PorterDuff.Mode.SRC_IN);
         canvas.setBitmap(null);
 
         return b;
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index e5169a2..d7562a9 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -43,8 +43,6 @@
 final class Utilities {
     private static final String TAG = "Launcher.Utilities";
 
-    private static final boolean TEXT_BURN = false;
-
     private static int sIconWidth = -1;
     private static int sIconHeight = -1;
     private static int sIconTextureWidth = -1;