Merge "Fix bug where not all views are getting disabled alpha applied." into tm-dev
diff --git a/res/color/dream_card_color_state_list.xml b/res/color/dream_card_color_state_list.xml
index 0799dc6..b0c86bb 100644
--- a/res/color/dream_card_color_state_list.xml
+++ b/res/color/dream_card_color_state_list.xml
@@ -17,8 +17,6 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android"
           xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
-    <item android:state_enabled="false" android:color="?androidprv:attr/colorSurface"
-          android:alpha="?android:attr/disabledAlpha"/>
     <item android:state_selected="true" android:color="?androidprv:attr/colorAccentPrimary"/>
     <item android:color="?androidprv:attr/colorSurface"/>
 </selector>
\ No newline at end of file
diff --git a/res/color/dream_card_text_color_state_list.xml b/res/color/dream_card_text_color_state_list.xml
index 2ca7a0f..438855f 100644
--- a/res/color/dream_card_text_color_state_list.xml
+++ b/res/color/dream_card_text_color_state_list.xml
@@ -17,8 +17,6 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android"
           xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
-    <item android:state_enabled="false" android:color="?android:attr/textColorPrimary"
-          android:alpha="?android:attr/disabledAlpha"/>
     <item android:state_selected="true" android:color="?androidprv:attr/textColorOnAccent"/>
     <item android:color="?android:attr/textColorPrimary"/>
 </selector>
\ No newline at end of file
diff --git a/src/com/android/settings/dream/DreamAdapter.java b/src/com/android/settings/dream/DreamAdapter.java
index 27c32df..ea64e8d 100644
--- a/src/com/android/settings/dream/DreamAdapter.java
+++ b/src/com/android/settings/dream/DreamAdapter.java
@@ -50,14 +50,13 @@
      * View holder for each {@link IDreamItem}.
      */
     private class DreamViewHolder extends RecyclerView.ViewHolder {
-        private static final int VALUE_ENABLED_ALPHA = 255;
         private final TextView mTitleView;
         private final TextView mSummaryView;
         private final ImageView mPreviewView;
         private final ImageView mPreviewPlaceholderView;
         private final Button mCustomizeButton;
         private final Context mContext;
-        private final int mDisabledAlphaValue;
+        private final float mDisabledAlphaValue;
 
         DreamViewHolder(View view, Context context) {
             super(view);
@@ -67,7 +66,7 @@
             mTitleView = view.findViewById(R.id.title_text);
             mSummaryView = view.findViewById(R.id.summary_text);
             mCustomizeButton = view.findViewById(R.id.customize_button);
-            mDisabledAlphaValue = (int) (ColorUtil.getDisabledAlpha(context) * VALUE_ENABLED_ALPHA);
+            mDisabledAlphaValue = ColorUtil.getDisabledAlpha(context);
         }
 
         /**
@@ -93,7 +92,6 @@
                 mPreviewView.setImageDrawable(null);
                 mPreviewPlaceholderView.setVisibility(View.VISIBLE);
             }
-            mPreviewView.setImageAlpha(getAlpha());
 
             final Drawable icon = item.isActive()
                     ? mContext.getDrawable(R.drawable.ic_dream_check_circle)
@@ -105,7 +103,6 @@
             final int iconSize = mContext.getResources().getDimensionPixelSize(
                     R.dimen.dream_item_icon_size);
             icon.setBounds(0, 0, iconSize, iconSize);
-            icon.setAlpha(getAlpha());
             mTitleView.setCompoundDrawablesRelative(icon, null, null, null);
 
             if (item.isActive()) {
@@ -130,10 +127,6 @@
             setEnabledStateOnViews(itemView, mEnabled);
         }
 
-        private int getAlpha() {
-            return mEnabled ? VALUE_ENABLED_ALPHA : mDisabledAlphaValue;
-        }
-
         /**
          * Makes sure the view (and any children) get the enabled state changed.
          */
@@ -145,6 +138,8 @@
                 for (int i = vg.getChildCount() - 1; i >= 0; i--) {
                     setEnabledStateOnViews(vg.getChildAt(i), enabled);
                 }
+            } else {
+                v.setAlpha(enabled ? 1 : mDisabledAlphaValue);
             }
         }
     }