Added highlighting to laneview

Fix: 123097743
Test: Manual

Change-Id: I97bb448d1d0eeba7e7ecc601ae3828ada1a69163
(cherry picked from commit a0a7b4861d94bdf7fb94380561b2619daa4d6b3d)
diff --git a/tests/DirectRenderingClusterSample/res/values/colors.xml b/tests/DirectRenderingClusterSample/res/values/colors.xml
index 6798b91..6ede0e7 100644
--- a/tests/DirectRenderingClusterSample/res/values/colors.xml
+++ b/tests/DirectRenderingClusterSample/res/values/colors.xml
@@ -9,4 +9,7 @@
     <color name="icon_selected">#6EDDFF</color>
     <color name="icon_unselected">#1B378A</color>
 
+    <!-- LaneView highlight colors -->
+    <color name="laneDirection">#888888</color>
+    <color name="laneDirectionHighlighted">#FFFFFF</color>
 </resources>
diff --git a/tests/DirectRenderingClusterSample/src/android/car/cluster/sample/LaneView.java b/tests/DirectRenderingClusterSample/src/android/car/cluster/sample/LaneView.java
index a4c367b..6e86b92 100644
--- a/tests/DirectRenderingClusterSample/src/android/car/cluster/sample/LaneView.java
+++ b/tests/DirectRenderingClusterSample/src/android/car/cluster/sample/LaneView.java
@@ -19,7 +19,8 @@
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
-import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.VectorDrawable;
 import android.util.AttributeSet;
@@ -60,7 +61,6 @@
         for (Lane lane : mLanes) {
             Bitmap bitmap = combineBitmapFromLane(lane);
             ImageView imgView = new ImageView(getContext());
-            imgView.setColorFilter(Color.WHITE);
             imgView.setImageBitmap(bitmap);
             imgView.setAdjustViewBounds(true);
             addView(imgView);
@@ -68,25 +68,39 @@
     }
 
     private Bitmap combineBitmapFromLane(Lane lane) {
-        Bitmap bitmap = null;
-        Canvas canvas = null;
+        if (lane.getDirections().isEmpty()) {
+            return null;
+        }
+
+        Bitmap bitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888);
+        Canvas canvas = new Canvas(bitmap);
 
         for (LaneDirection laneDir : lane.getDirections()) {
-            VectorDrawable icon = (VectorDrawable) getLaneIcon(laneDir);
-
-            icon.setBounds(0, 0, mWidth, mHeight);
-
-            if (bitmap == null) {
-                bitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888);
-                canvas = new Canvas(bitmap);
+            if (!laneDir.isHighlighted()) {
+                drawToCanvas(laneDir, canvas, false);
             }
+        }
 
-            icon.draw(canvas);
+        for (LaneDirection laneDir : lane.getDirections()) {
+            if (laneDir.isHighlighted()) {
+                drawToCanvas(laneDir, canvas, true);
+            }
         }
 
         return bitmap;
     }
 
+
+    private void drawToCanvas(LaneDirection laneDir, Canvas canvas, boolean isHighlighted) {
+        VectorDrawable icon = (VectorDrawable) getLaneIcon(laneDir);
+        icon.setBounds(0, 0, mWidth, mHeight);
+        icon.setColorFilter(new PorterDuffColorFilter(isHighlighted
+                ? getContext().getColor(R.color.laneDirectionHighlighted)
+                : getContext().getColor(R.color.laneDirection),
+                PorterDuff.Mode.SRC_ATOP));
+        icon.draw(canvas);
+    }
+
     private Drawable getLaneIcon(@Nullable LaneDirection laneDir) {
         if (laneDir == null) {
             return null;