Move layer-list to be top-level element in seek bar progress
There is a bug in <scale>, but this works around it for now. Removes the previous fix, which broke the initial state due to the level not propagating when the current drawable was swapped out. Bug: 19269656 Change-Id: Ibe586ef4ea326a7ce7516ca42a369c5386c24359
This commit is contained in:
@@ -1241,7 +1241,7 @@ public class ProgressBar extends View {
|
||||
private synchronized void doRefreshProgress(int id, int progress, boolean fromUser,
|
||||
boolean callBackToApp) {
|
||||
float scale = mMax > 0 ? (float) progress / (float) mMax : 0;
|
||||
final Drawable d = mCurrentDrawable.getCurrent();
|
||||
final Drawable d = mCurrentDrawable;
|
||||
if (d != null) {
|
||||
Drawable progressDrawable = null;
|
||||
|
||||
|
||||
@@ -14,29 +14,35 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false">
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@id/background">
|
||||
<nine-patch android:src="@drawable/scrubber_track_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
<item>
|
||||
<layer-list>
|
||||
<item android:id="@id/background">
|
||||
<nine-patch android:src="@drawable/scrubber_track_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
<item android:id="@id/secondaryProgress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<nine-patch android:src="@drawable/scrubber_primary_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</scale>
|
||||
</item>
|
||||
<item android:id="@id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<nine-patch android:src="@drawable/scrubber_primary_mtrl_alpha"
|
||||
android:tint="?attr/colorControlActivated" />
|
||||
</scale>
|
||||
</item>
|
||||
</layer-list>
|
||||
</item>
|
||||
</selector>
|
||||
<item android:id="@id/secondaryProgress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<selector>
|
||||
<item android:state_enabled="false">
|
||||
<color android:color="@color/transparent" />
|
||||
</item>
|
||||
<item>
|
||||
<nine-patch android:src="@drawable/scrubber_primary_mtrl_alpha"
|
||||
android:tint="?attr/colorControlNormal" />
|
||||
</item>
|
||||
</selector>
|
||||
</scale>
|
||||
</item>
|
||||
<item android:id="@id/progress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<selector>
|
||||
<item android:state_enabled="false">
|
||||
<color android:color="@color/transparent" />
|
||||
</item>
|
||||
<item>
|
||||
<nine-patch android:src="@drawable/scrubber_primary_mtrl_alpha"
|
||||
android:tint="?attr/colorControlActivated" />
|
||||
</item>
|
||||
</selector>
|
||||
</scale>
|
||||
</item>
|
||||
</layer-list>
|
||||
Reference in New Issue
Block a user