Modify qsb bar elements to handle hotword state.

They currently handle a pressed mode (showing a blue overlay), we'd like
them to also handle a hotword state that would modify their appearance
when hotword is available and active.

Meant to work with: ag/344334

Change-Id: I07e261ce64307fdad8a4c16fc02eb009ca826ece
diff --git a/src/com/android/launcher3/HolographicViewHelper.java b/src/com/android/launcher3/HolographicViewHelper.java
index 9d3ad70..7ef0355 100644
--- a/src/com/android/launcher3/HolographicViewHelper.java
+++ b/src/com/android/launcher3/HolographicViewHelper.java
@@ -30,11 +30,12 @@
     private final Canvas mTempCanvas = new Canvas();
 
     private boolean mStatesUpdated;
-    private int mHighlightColor;
+    private int mHighlightColor, mHotwordColor;
 
     public HolographicViewHelper(Context context) {
         Resources res = context.getResources();
         mHighlightColor = res.getColor(android.R.color.holo_blue_light);
+        mHotwordColor = res.getColor(android.R.color.holo_green_light);
     }
 
     /**
@@ -44,13 +45,17 @@
         if (!mStatesUpdated && v != null) {
             mStatesUpdated = true;
             Bitmap original = createOriginalImage(v, mTempCanvas);
-            Bitmap outline = createPressImage(v, mTempCanvas);
+            Bitmap outline = createImageWithOverlay(v, mTempCanvas, mHighlightColor);
+            Bitmap hotword = createImageWithOverlay(v, mTempCanvas, mHotwordColor);
             FastBitmapDrawable originalD = new FastBitmapDrawable(original);
             FastBitmapDrawable outlineD = new FastBitmapDrawable(outline);
+            FastBitmapDrawable hotwordD = new FastBitmapDrawable(hotword);
 
             StateListDrawable states = new StateListDrawable();
+
             states.addState(new int[] {android.R.attr.state_pressed}, outlineD);
             states.addState(new int[] {android.R.attr.state_focused}, outlineD);
+            states.addState(new int[] {R.attr.stateHotwordOn}, hotwordD);
             states.addState(new int[] {}, originalD);
             v.setImageDrawable(states);
         }
@@ -76,7 +81,7 @@
 
         canvas.setBitmap(b);
         canvas.save();
-            d.draw(canvas);
+        d.draw(canvas);
         canvas.restore();
         canvas.setBitmap(null);
 
@@ -87,16 +92,16 @@
      * Creates a new press state image which is the old image with a blue overlay.
      * Responsibility for the bitmap is transferred to the caller.
      */
-    private Bitmap createPressImage(ImageView v, Canvas canvas) {
+    private Bitmap createImageWithOverlay(ImageView v, Canvas canvas, int color) {
         final Drawable d = v.getDrawable();
         final Bitmap b = Bitmap.createBitmap(
                 d.getIntrinsicWidth(), d.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
 
         canvas.setBitmap(b);
         canvas.save();
-            d.draw(canvas);
+        d.draw(canvas);
         canvas.restore();
-        canvas.drawColor(mHighlightColor, PorterDuff.Mode.SRC_IN);
+        canvas.drawColor(color, PorterDuff.Mode.SRC_IN);
         canvas.setBitmap(null);
 
         return b;