OSDN Git Service

Update rating bar assets for Material
authorAlan Viverette <alanv@google.com>
Wed, 8 Apr 2015 17:49:26 +0000 (10:49 -0700)
committerAlan Viverette <alanv@google.com>
Wed, 8 Apr 2015 17:49:26 +0000 (10:49 -0700)
Also ensures that ProgressBar doesn't create a tiled drawable when it
doesn't actually need to.

Bug: 19574820
Change-Id: Id3b9b00e05a56055ed4b19def7044a0bf38e8ec1

40 files changed:
core/java/android/widget/ProgressBar.java
core/res/res/color/ratingbar_background_material.xml [new file with mode: 0644]
core/res/res/drawable-hdpi/ic_star_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-hdpi/ic_star_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-hdpi/ic_star_black_48dp.png [new file with mode: 0644]
core/res/res/drawable-hdpi/ic_star_half_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-hdpi/ic_star_half_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-hdpi/ic_star_half_black_48dp.png [new file with mode: 0644]
core/res/res/drawable-mdpi/ic_star_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-mdpi/ic_star_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-mdpi/ic_star_black_48dp.png [new file with mode: 0644]
core/res/res/drawable-mdpi/ic_star_half_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-mdpi/ic_star_half_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-mdpi/ic_star_half_black_48dp.png [new file with mode: 0644]
core/res/res/drawable-xhdpi/ic_star_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-xhdpi/ic_star_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-xhdpi/ic_star_black_48dp.png [new file with mode: 0644]
core/res/res/drawable-xhdpi/ic_star_half_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-xhdpi/ic_star_half_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-xhdpi/ic_star_half_black_48dp.png [new file with mode: 0644]
core/res/res/drawable-xxhdpi/ic_star_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-xxhdpi/ic_star_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-xxhdpi/ic_star_black_48dp.png [new file with mode: 0644]
core/res/res/drawable-xxhdpi/ic_star_half_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-xxhdpi/ic_star_half_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-xxhdpi/ic_star_half_black_48dp.png [new file with mode: 0644]
core/res/res/drawable-xxxhdpi/ic_star_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-xxxhdpi/ic_star_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-xxxhdpi/ic_star_black_48dp.png [new file with mode: 0644]
core/res/res/drawable-xxxhdpi/ic_star_half_black_16dp.png [new file with mode: 0644]
core/res/res/drawable-xxxhdpi/ic_star_half_black_36dp.png [new file with mode: 0644]
core/res/res/drawable-xxxhdpi/ic_star_half_black_48dp.png [new file with mode: 0644]
core/res/res/drawable/ratingbar_full_empty_material.xml
core/res/res/drawable/ratingbar_full_filled_material.xml
core/res/res/drawable/ratingbar_full_half_material.xml [moved from core/res/res/drawable/ratingbar_full_material.xml with 60% similarity]
core/res/res/drawable/ratingbar_indicator_material.xml [new file with mode: 0644]
core/res/res/drawable/ratingbar_material.xml [new file with mode: 0644]
core/res/res/drawable/ratingbar_small_material.xml [new file with mode: 0644]
core/res/res/values/arrays.xml
core/res/res/values/styles_material.xml

index 205d35e..24e9cbe 100644 (file)
@@ -60,7 +60,6 @@ import android.widget.RemoteViews.RemoteView;
 
 import java.util.ArrayList;
 
-
 /**
  * <p>
  * Visual indicator of progress in some operation.  Displays a bar to the user
@@ -266,9 +265,14 @@ public class ProgressBar extends View {
 
         final Drawable progressDrawable = a.getDrawable(R.styleable.ProgressBar_progressDrawable);
         if (progressDrawable != null) {
-            // Calling this method can set mMaxHeight, make sure the corresponding
-            // XML attribute for mMaxHeight is read after calling this method
-            setProgressDrawableTiled(progressDrawable);
+            // Calling setProgressDrawable can set mMaxHeight, so make sure the
+            // corresponding XML attribute for mMaxHeight is read after calling
+            // this method.
+            if (needsTileify(progressDrawable)) {
+                setProgressDrawableTiled(progressDrawable);
+            } else {
+                setProgressDrawable(progressDrawable);
+            }
         }
 
 
@@ -292,13 +296,17 @@ public class ProgressBar extends View {
 
         setProgress(a.getInt(R.styleable.ProgressBar_progress, mProgress));
 
-        setSecondaryProgress(
-                a.getInt(R.styleable.ProgressBar_secondaryProgress, mSecondaryProgress));
+        setSecondaryProgress(a.getInt(
+                R.styleable.ProgressBar_secondaryProgress, mSecondaryProgress));
 
         final Drawable indeterminateDrawable = a.getDrawable(
                 R.styleable.ProgressBar_indeterminateDrawable);
         if (indeterminateDrawable != null) {
-            setIndeterminateDrawableTiled(indeterminateDrawable);
+            if (needsTileify(indeterminateDrawable)) {
+                setIndeterminateDrawableTiled(indeterminateDrawable);
+            } else {
+                setIndeterminateDrawable(indeterminateDrawable);
+            }
         }
 
         mOnlyIndeterminate = a.getBoolean(
@@ -395,6 +403,45 @@ public class ProgressBar extends View {
     }
 
     /**
+     * Returns {@code true} if the target drawable needs to be tileified.
+     *
+     * @param dr the drawable to check
+     * @return {@code true} if the target drawable needs to be tileified,
+     *         {@code false} otherwise
+     */
+    private static boolean needsTileify(Drawable dr) {
+        if (dr instanceof LayerDrawable) {
+            final LayerDrawable orig = (LayerDrawable) dr;
+            final int N = orig.getNumberOfLayers();
+            for (int i = 0; i < N; i++) {
+                if (needsTileify(orig.getDrawable(i))) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        if (dr instanceof StateListDrawable) {
+            final StateListDrawable in = (StateListDrawable) dr;
+            final int N = in.getStateCount();
+            for (int i = 0; i < N; i++) {
+                if (needsTileify(in.getStateDrawable(i))) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        // If there's a bitmap that's not wrapped with a ClipDrawable or
+        // ScaleDrawable, we'll need to wrap it and apply tiling.
+        if (dr instanceof BitmapDrawable) {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
      * Converts a drawable to a tiled version of itself. It will recursively
      * traverse layer and state list drawables.
      */
@@ -448,18 +495,14 @@ public class ProgressBar extends View {
                 mSampleTile = tileBitmap;
             }
 
-            final ShapeDrawable shapeDrawable = new ShapeDrawable(getDrawableShape());
-            final BitmapShader bitmapShader = new BitmapShader(tileBitmap,
-                    Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
-            shapeDrawable.getPaint().setShader(bitmapShader);
+            final BitmapDrawable clone = (BitmapDrawable) bitmap.getConstantState().newDrawable();
+            clone.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
 
-            // Ensure the tint and filter are propagated in the correct order.
-            shapeDrawable.setTintList(bitmap.getTint());
-            shapeDrawable.setTintMode(bitmap.getTintMode());
-            shapeDrawable.setColorFilter(bitmap.getColorFilter());
-
-            return clip ? new ClipDrawable(
-                    shapeDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL) : shapeDrawable;
+            if (clip) {
+                return new ClipDrawable(clone, Gravity.LEFT, ClipDrawable.HORIZONTAL);
+            } else {
+                return clone;
+            }
         }
 
         return drawable;
diff --git a/core/res/res/color/ratingbar_background_material.xml b/core/res/res/color/ratingbar_background_material.xml
new file mode 100644 (file)
index 0000000..e6f7488
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:state_pressed="true"
+        android:color="?attr/colorControlActivated"
+        android:alpha="?attr/disabledAlpha" />
+    <item
+        android:color="?attr/colorControlNormal"
+        android:alpha="?attr/disabledAlpha" />
+</selector>
diff --git a/core/res/res/drawable-hdpi/ic_star_black_16dp.png b/core/res/res/drawable-hdpi/ic_star_black_16dp.png
new file mode 100644 (file)
index 0000000..a728afe
Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_star_black_16dp.png differ
diff --git a/core/res/res/drawable-hdpi/ic_star_black_36dp.png b/core/res/res/drawable-hdpi/ic_star_black_36dp.png
new file mode 100644 (file)
index 0000000..4f67f97
Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_star_black_36dp.png differ
diff --git a/core/res/res/drawable-hdpi/ic_star_black_48dp.png b/core/res/res/drawable-hdpi/ic_star_black_48dp.png
new file mode 100644 (file)
index 0000000..54d3065
Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_star_black_48dp.png differ
diff --git a/core/res/res/drawable-hdpi/ic_star_half_black_16dp.png b/core/res/res/drawable-hdpi/ic_star_half_black_16dp.png
new file mode 100644 (file)
index 0000000..89919a3
Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_star_half_black_16dp.png differ
diff --git a/core/res/res/drawable-hdpi/ic_star_half_black_36dp.png b/core/res/res/drawable-hdpi/ic_star_half_black_36dp.png
new file mode 100644 (file)
index 0000000..d28afab
Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_star_half_black_36dp.png differ
diff --git a/core/res/res/drawable-hdpi/ic_star_half_black_48dp.png b/core/res/res/drawable-hdpi/ic_star_half_black_48dp.png
new file mode 100644 (file)
index 0000000..befe521
Binary files /dev/null and b/core/res/res/drawable-hdpi/ic_star_half_black_48dp.png differ
diff --git a/core/res/res/drawable-mdpi/ic_star_black_16dp.png b/core/res/res/drawable-mdpi/ic_star_black_16dp.png
new file mode 100644 (file)
index 0000000..3f5d25e
Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_star_black_16dp.png differ
diff --git a/core/res/res/drawable-mdpi/ic_star_black_36dp.png b/core/res/res/drawable-mdpi/ic_star_black_36dp.png
new file mode 100644 (file)
index 0000000..92a0f58
Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_star_black_36dp.png differ
diff --git a/core/res/res/drawable-mdpi/ic_star_black_48dp.png b/core/res/res/drawable-mdpi/ic_star_black_48dp.png
new file mode 100644 (file)
index 0000000..c636ce8
Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_star_black_48dp.png differ
diff --git a/core/res/res/drawable-mdpi/ic_star_half_black_16dp.png b/core/res/res/drawable-mdpi/ic_star_half_black_16dp.png
new file mode 100644 (file)
index 0000000..beea92a
Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_star_half_black_16dp.png differ
diff --git a/core/res/res/drawable-mdpi/ic_star_half_black_36dp.png b/core/res/res/drawable-mdpi/ic_star_half_black_36dp.png
new file mode 100644 (file)
index 0000000..5caae60
Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_star_half_black_36dp.png differ
diff --git a/core/res/res/drawable-mdpi/ic_star_half_black_48dp.png b/core/res/res/drawable-mdpi/ic_star_half_black_48dp.png
new file mode 100644 (file)
index 0000000..d53afa2
Binary files /dev/null and b/core/res/res/drawable-mdpi/ic_star_half_black_48dp.png differ
diff --git a/core/res/res/drawable-xhdpi/ic_star_black_16dp.png b/core/res/res/drawable-xhdpi/ic_star_black_16dp.png
new file mode 100644 (file)
index 0000000..732c48e
Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_star_black_16dp.png differ
diff --git a/core/res/res/drawable-xhdpi/ic_star_black_36dp.png b/core/res/res/drawable-xhdpi/ic_star_black_36dp.png
new file mode 100644 (file)
index 0000000..54d3065
Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_star_black_36dp.png differ
diff --git a/core/res/res/drawable-xhdpi/ic_star_black_48dp.png b/core/res/res/drawable-xhdpi/ic_star_black_48dp.png
new file mode 100644 (file)
index 0000000..7be2280
Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_star_black_48dp.png differ
diff --git a/core/res/res/drawable-xhdpi/ic_star_half_black_16dp.png b/core/res/res/drawable-xhdpi/ic_star_half_black_16dp.png
new file mode 100644 (file)
index 0000000..5d6f3c8
Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_star_half_black_16dp.png differ
diff --git a/core/res/res/drawable-xhdpi/ic_star_half_black_36dp.png b/core/res/res/drawable-xhdpi/ic_star_half_black_36dp.png
new file mode 100644 (file)
index 0000000..2ed3a20
Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_star_half_black_36dp.png differ
diff --git a/core/res/res/drawable-xhdpi/ic_star_half_black_48dp.png b/core/res/res/drawable-xhdpi/ic_star_half_black_48dp.png
new file mode 100644 (file)
index 0000000..348d4d8
Binary files /dev/null and b/core/res/res/drawable-xhdpi/ic_star_half_black_48dp.png differ
diff --git a/core/res/res/drawable-xxhdpi/ic_star_black_16dp.png b/core/res/res/drawable-xxhdpi/ic_star_black_16dp.png
new file mode 100644 (file)
index 0000000..c636ce8
Binary files /dev/null and b/core/res/res/drawable-xxhdpi/ic_star_black_16dp.png differ
diff --git a/core/res/res/drawable-xxhdpi/ic_star_black_36dp.png b/core/res/res/drawable-xxhdpi/ic_star_black_36dp.png
new file mode 100644 (file)
index 0000000..52d03f1
Binary files /dev/null and b/core/res/res/drawable-xxhdpi/ic_star_black_36dp.png differ
diff --git a/core/res/res/drawable-xxhdpi/ic_star_black_48dp.png b/core/res/res/drawable-xxhdpi/ic_star_black_48dp.png
new file mode 100644 (file)
index 0000000..918a395
Binary files /dev/null and b/core/res/res/drawable-xxhdpi/ic_star_black_48dp.png differ
diff --git a/core/res/res/drawable-xxhdpi/ic_star_half_black_16dp.png b/core/res/res/drawable-xxhdpi/ic_star_half_black_16dp.png
new file mode 100644 (file)
index 0000000..9b268d1
Binary files /dev/null and b/core/res/res/drawable-xxhdpi/ic_star_half_black_16dp.png differ
diff --git a/core/res/res/drawable-xxhdpi/ic_star_half_black_36dp.png b/core/res/res/drawable-xxhdpi/ic_star_half_black_36dp.png
new file mode 100644 (file)
index 0000000..167d8ae
Binary files /dev/null and b/core/res/res/drawable-xxhdpi/ic_star_half_black_36dp.png differ
diff --git a/core/res/res/drawable-xxhdpi/ic_star_half_black_48dp.png b/core/res/res/drawable-xxhdpi/ic_star_half_black_48dp.png
new file mode 100644 (file)
index 0000000..64e76bb
Binary files /dev/null and b/core/res/res/drawable-xxhdpi/ic_star_half_black_48dp.png differ
diff --git a/core/res/res/drawable-xxxhdpi/ic_star_black_16dp.png b/core/res/res/drawable-xxxhdpi/ic_star_black_16dp.png
new file mode 100644 (file)
index 0000000..1fa274d
Binary files /dev/null and b/core/res/res/drawable-xxxhdpi/ic_star_black_16dp.png differ
diff --git a/core/res/res/drawable-xxxhdpi/ic_star_black_36dp.png b/core/res/res/drawable-xxxhdpi/ic_star_black_36dp.png
new file mode 100644 (file)
index 0000000..918a395
Binary files /dev/null and b/core/res/res/drawable-xxxhdpi/ic_star_black_36dp.png differ
diff --git a/core/res/res/drawable-xxxhdpi/ic_star_black_48dp.png b/core/res/res/drawable-xxxhdpi/ic_star_black_48dp.png
new file mode 100644 (file)
index 0000000..67e25d5
Binary files /dev/null and b/core/res/res/drawable-xxxhdpi/ic_star_black_48dp.png differ
diff --git a/core/res/res/drawable-xxxhdpi/ic_star_half_black_16dp.png b/core/res/res/drawable-xxxhdpi/ic_star_half_black_16dp.png
new file mode 100644 (file)
index 0000000..266c167
Binary files /dev/null and b/core/res/res/drawable-xxxhdpi/ic_star_half_black_16dp.png differ
diff --git a/core/res/res/drawable-xxxhdpi/ic_star_half_black_36dp.png b/core/res/res/drawable-xxxhdpi/ic_star_half_black_36dp.png
new file mode 100644 (file)
index 0000000..debdb77
Binary files /dev/null and b/core/res/res/drawable-xxxhdpi/ic_star_half_black_36dp.png differ
diff --git a/core/res/res/drawable-xxxhdpi/ic_star_half_black_48dp.png b/core/res/res/drawable-xxxhdpi/ic_star_half_black_48dp.png
new file mode 100644 (file)
index 0000000..bfb6e61
Binary files /dev/null and b/core/res/res/drawable-xxxhdpi/ic_star_half_black_48dp.png differ
index a2ae7d9..12b01ba 100644 (file)
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_pressed="true">
-        <bitmap android:src="@drawable/btn_rating_star_off_mtrl_alpha"
-            android:tint="?attr/colorControlActivated" />
+        <bitmap
+            android:src="@drawable/btn_rating_star_off_mtrl_alpha"
+            android:tint="?attr/colorControlActivated"
+            android:alpha="?attr/disabledAlpha"/>
     </item>
     <item>
-        <bitmap android:src="@drawable/btn_rating_star_off_mtrl_alpha"
+        <bitmap
+            android:src="@drawable/btn_rating_star_off_mtrl_alpha"
             android:tint="?attr/colorControlNormal" />
     </item>
 </selector>
index 801c85f..f167dae 100644 (file)
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_pressed="true">
-        <bitmap android:src="@drawable/btn_rating_star_on_mtrl_alpha"
+        <bitmap
+            android:src="@drawable/btn_rating_star_on_mtrl_alpha"
             android:tint="?attr/colorControlActivated" />
     </item>
     <item>
-        <bitmap android:src="@drawable/btn_rating_star_on_mtrl_alpha"
+        <bitmap
+            android:src="@drawable/btn_rating_star_on_mtrl_alpha"
             android:tint="?attr/colorControlNormal" />
     </item>
 </selector>
      limitations under the License.
 -->
 
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:id="@id/background"
-        android:drawable="@drawable/ratingbar_full_empty_material" />
-    <item android:id="@id/secondaryProgress"
-        android:drawable="@drawable/ratingbar_full_empty_material" />
-    <item android:id="@id/progress" 
-        android:drawable="@drawable/ratingbar_full_filled_material" />
-</layer-list>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true">
+        <bitmap
+            android:src="@drawable/btn_rating_star_off_mtrl_alpha"
+            android:tint="?attr/colorControlActivated" />
+    </item>
+    <item>
+        <bitmap
+            android:src="@drawable/btn_rating_star_off_mtrl_alpha"
+            android:tint="?attr/colorControlNormal" />
+    </item>
+</selector>
diff --git a/core/res/res/drawable/ratingbar_indicator_material.xml b/core/res/res/drawable/ratingbar_indicator_material.xml
new file mode 100644 (file)
index 0000000..d8c6ee1
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/background">
+        <bitmap
+            android:src="@drawable/ic_star_black_36dp"
+            android:tint="?attr/colorControlNormal"
+            android:alpha="?attr/disabledAlpha" />
+    </item>
+    <item android:id="@+id/secondaryProgress">
+        <bitmap
+            android:src="@drawable/ic_star_half_black_36dp"
+            android:tint="?attr/colorControlActivated" />
+    </item>
+    <item android:id="@+id/progress">
+        <bitmap
+            android:src="@drawable/ic_star_black_36dp"
+            android:tint="?attr/colorControlActivated"
+            android:tileModeX="repeat" />
+    </item>
+</layer-list>
diff --git a/core/res/res/drawable/ratingbar_material.xml b/core/res/res/drawable/ratingbar_material.xml
new file mode 100644 (file)
index 0000000..0cd7fac
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/background">
+        <bitmap
+            android:src="@drawable/ic_star_black_48dp"
+            android:tint="@color/ratingbar_background_material" />
+    </item>
+    <item android:id="@+id/secondaryProgress">
+        <bitmap
+            android:src="@drawable/ic_star_half_black_48dp"
+            android:tint="?attr/colorControlActivated" />
+    </item>
+    <item android:id="@+id/progress">
+        <bitmap
+            android:src="@drawable/ic_star_black_48dp"
+            android:tint="?attr/colorControlActivated" />
+    </item>
+</layer-list>
diff --git a/core/res/res/drawable/ratingbar_small_material.xml b/core/res/res/drawable/ratingbar_small_material.xml
new file mode 100644 (file)
index 0000000..f24241c
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/background">
+        <bitmap
+            android:src="@drawable/ic_star_black_16dp"
+            android:tint="?attr/colorControlNormal"
+            android:alpha="?attr/disabledAlpha" />
+    </item>
+    <item android:id="@+id/secondaryProgress">
+        <bitmap
+            android:src="@drawable/ic_star_half_black_16dp"
+            android:tint="?attr/colorControlActivated" />
+    </item>
+    <item android:id="@+id/progress">
+        <bitmap
+            android:src="@drawable/ic_star_black_16dp"
+            android:tint="?attr/colorControlActivated"
+            android:tileModeX="repeat" />
+    </item>
+</layer-list>
index 3312f4f..f6df01f 100644 (file)
        <item>@drawable/progress_large_material</item>
        <item>@drawable/progress_medium_material</item>
        <item>@drawable/progress_small_material</item>
-       <item>@drawable/ratingbar_full_empty_material</item>
-       <item>@drawable/ratingbar_full_filled_material</item>
-       <item>@drawable/ratingbar_full_material</item>
+       <item>@drawable/ratingbar_material</item>
+       <item>@drawable/ratingbar_small_material</item>
+       <item>@drawable/ratingbar_indicator_material</item>
        <item>@drawable/scrollbar_handle_material</item>
        <item>@drawable/scrubber_control_material_anim</item>
        <item>@drawable/scrubber_control_selector_material</item>
index 9cf7884..aac58bb 100644 (file)
@@ -726,22 +726,22 @@ please see styles_device_defaults.xml.
     </style>
 
     <style name="Widget.Material.RatingBar" parent="Widget.RatingBar">
-        <item name="progressDrawable">@drawable/ratingbar_full_material</item>
-        <item name="indeterminateDrawable">@drawable/ratingbar_full_material</item>
+        <item name="progressDrawable">@drawable/ratingbar_material</item>
+        <item name="indeterminateDrawable">@drawable/ratingbar_material</item>
     </style>
 
     <style name="Widget.Material.RatingBar.Indicator" parent="Widget.RatingBar.Indicator">
-        <item name="progressDrawable">@drawable/ratingbar_holo_dark</item>
-        <item name="indeterminateDrawable">@drawable/ratingbar_holo_dark</item>
-        <item name="minHeight">35dip</item>
-        <item name="maxHeight">35dip</item>
+        <item name="progressDrawable">@drawable/ratingbar_indicator_material</item>
+        <item name="indeterminateDrawable">@drawable/ratingbar_indicator_material</item>
+        <item name="minHeight">36dp</item>
+        <item name="maxHeight">36dp</item>
     </style>
 
     <style name="Widget.Material.RatingBar.Small" parent="Widget.RatingBar.Small">
-        <item name="progressDrawable">@drawable/ratingbar_small_holo_dark</item>
-        <item name="indeterminateDrawable">@drawable/ratingbar_small_holo_dark</item>
-        <item name="minHeight">16dip</item>
-        <item name="maxHeight">16dip</item>
+        <item name="progressDrawable">@drawable/ratingbar_small_material</item>
+        <item name="indeterminateDrawable">@drawable/ratingbar_small_material</item>
+        <item name="minHeight">16dp</item>
+        <item name="maxHeight">16dp</item>
     </style>
 
     <style name="Widget.Material.ScrollView" parent="Widget.ScrollView"/>
@@ -1038,22 +1038,9 @@ please see styles_device_defaults.xml.
     <style name="Widget.Material.Light.ProgressBar.Small.Inverse" parent="Widget.Material.ProgressBar.Small.Inverse"/>
     <style name="Widget.Material.Light.ProgressBar.Large.Inverse" parent="Widget.Material.ProgressBar.Large.Inverse"/>
     <style name="Widget.Material.Light.SeekBar" parent="Widget.Material.SeekBar"/>
-    <style name="Widget.Material.Light.RatingBar" parent="Widget.Material.RatingBar" />
-
-    <style name="Widget.Material.Light.RatingBar.Indicator" parent="Widget.RatingBar.Indicator">
-        <item name="progressDrawable">@drawable/ratingbar_holo_light</item>
-        <item name="indeterminateDrawable">@drawable/ratingbar_holo_light</item>
-        <item name="minHeight">35dip</item>
-        <item name="maxHeight">35dip</item>
-    </style>
-
-    <style name="Widget.Material.Light.RatingBar.Small" parent="Widget.RatingBar.Small">
-        <item name="progressDrawable">@drawable/ratingbar_small_holo_light</item>
-        <item name="indeterminateDrawable">@drawable/ratingbar_small_holo_light</item>
-        <item name="minHeight">16dip</item>
-        <item name="maxHeight">16dip</item>
-    </style>
-
+    <style name="Widget.Material.Light.RatingBar" parent="Widget.Material.RatingBar"/>
+    <style name="Widget.Material.Light.RatingBar.Indicator" parent="Widget.Material.RatingBar.Indicator"/>
+    <style name="Widget.Material.Light.RatingBar.Small" parent="Widget.Material.RatingBar.Small"/>
     <style name="Widget.Material.Light.ScrollView" parent="Widget.Material.ScrollView"/>
     <style name="Widget.Material.Light.HorizontalScrollView" parent="Widget.Material.HorizontalScrollView"/>
     <style name="Widget.Material.Light.Spinner" parent="Widget.Material.Spinner" />