MediaRouter: Make the scroll thumb transparent when route is unavailable

Bug: 23725583
Change-Id: If9f686bec0e6808613cb955b55915c7238e8832b
diff --git a/v7/mediarouter/jellybean/android/support/v7/media/SeekBarJellybean.java b/v7/mediarouter/jellybean/android/support/v7/media/SeekBarJellybean.java
new file mode 100644
index 0000000..76bf6fd
--- /dev/null
+++ b/v7/mediarouter/jellybean/android/support/v7/media/SeekBarJellybean.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.support.v7.media;
+
+import android.graphics.drawable.Drawable;
+import android.widget.SeekBar;
+
+/**
+ * @hide
+ */
+public class SeekBarJellybean {
+    public static Drawable getThumb(SeekBar seekBar) {
+        return seekBar.getThumb();
+    }
+}
diff --git a/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java b/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java
index d78af8f..c92493d 100644
--- a/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java
+++ b/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java
@@ -29,6 +29,7 @@
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.AsyncTask;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.RemoteException;
 import android.support.v4.media.MediaDescriptionCompat;
@@ -39,6 +40,7 @@
 import android.support.v7.graphics.Palette;
 import android.support.v7.media.MediaRouteSelector;
 import android.support.v7.media.MediaRouter;
+import android.support.v7.media.SeekBarJellybean;
 import android.support.v7.mediarouter.R;
 import android.text.TextUtils;
 import android.util.DisplayMetrics;
@@ -710,10 +712,10 @@
                         volumeSlider.setEnabled(false);
                     }
                 }
-                // TODO: Find a way to hide the scroll thumb.
-                // if (Build.VERSION.SDK_INT >= 16) {
-                //     volumeSlider.getThumb().setAlpha(isEnabled ? 255 : 0);
-                // }
+                if (Build.VERSION.SDK_INT >= 16) {
+                    SeekBarJellybean.getThumb(volumeSlider).mutate().setAlpha(isEnabled ? 255 : 0);
+                    // TODO: Still see an artifact even though the thumb is transparent. Remove it.
+                }
 
                 ImageView volumeItemIcon =
                         (ImageView) v.findViewById(R.id.mr_volume_item_icon);