From 87e1938be8e6c2ac7e6163a63df5dd69633cc836 Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Fri, 29 May 2015 15:12:14 -0700 Subject: Replace PNG-based seekbar thumb animation with AVD Adds optical inset support for VectorDrawable and GradientDrawable. Bug: 19944181 Change-Id: I9df04d9fe17ad858413e7f93694bf37ee2c43c85 --- core/java/android/widget/AbsSeekBar.java | 26 +++--- ..._thumb_pressed_to_unpressed_thumb_animation.xml | 18 +++++ ...humb_unpressed_to_pressed_thumb_0_animation.xml | 18 +++++ .../scrubber_control_from_pressed_mtrl_000.png | Bin 615 -> 0 bytes .../scrubber_control_from_pressed_mtrl_001.png | Bin 578 -> 0 bytes .../scrubber_control_from_pressed_mtrl_002.png | Bin 562 -> 0 bytes .../scrubber_control_from_pressed_mtrl_003.png | Bin 519 -> 0 bytes .../scrubber_control_from_pressed_mtrl_004.png | Bin 527 -> 0 bytes .../scrubber_control_from_pressed_mtrl_005.png | Bin 496 -> 0 bytes .../scrubber_control_off_mtrl_alpha.png | Bin 232 -> 0 bytes .../scrubber_control_off_pressed_mtrl_alpha.png | Bin 755 -> 0 bytes .../scrubber_control_to_pressed_mtrl_000.png | Bin 498 -> 0 bytes .../scrubber_control_to_pressed_mtrl_001.png | Bin 522 -> 0 bytes .../scrubber_control_to_pressed_mtrl_002.png | Bin 587 -> 0 bytes .../scrubber_control_to_pressed_mtrl_003.png | Bin 615 -> 0 bytes .../scrubber_control_to_pressed_mtrl_004.png | Bin 613 -> 0 bytes .../scrubber_control_to_pressed_mtrl_005.png | Bin 629 -> 0 bytes .../scrubber_control_from_pressed_mtrl_000.png | Bin 498 -> 0 bytes .../scrubber_control_from_pressed_mtrl_001.png | Bin 474 -> 0 bytes .../scrubber_control_from_pressed_mtrl_002.png | Bin 454 -> 0 bytes .../scrubber_control_from_pressed_mtrl_003.png | Bin 447 -> 0 bytes .../scrubber_control_from_pressed_mtrl_004.png | Bin 428 -> 0 bytes .../scrubber_control_from_pressed_mtrl_005.png | Bin 437 -> 0 bytes .../scrubber_control_off_mtrl_alpha.png | Bin 181 -> 0 bytes .../scrubber_control_off_pressed_mtrl_alpha.png | Bin 456 -> 0 bytes .../scrubber_control_to_pressed_mtrl_000.png | Bin 437 -> 0 bytes .../scrubber_control_to_pressed_mtrl_001.png | Bin 451 -> 0 bytes .../scrubber_control_to_pressed_mtrl_002.png | Bin 478 -> 0 bytes .../scrubber_control_to_pressed_mtrl_003.png | Bin 502 -> 0 bytes .../scrubber_control_to_pressed_mtrl_004.png | Bin 487 -> 0 bytes .../scrubber_control_to_pressed_mtrl_005.png | Bin 498 -> 0 bytes .../scrubber_control_from_pressed_mtrl_000.png | Bin 785 -> 0 bytes .../scrubber_control_from_pressed_mtrl_001.png | Bin 706 -> 0 bytes .../scrubber_control_from_pressed_mtrl_002.png | Bin 664 -> 0 bytes .../scrubber_control_from_pressed_mtrl_003.png | Bin 617 -> 0 bytes .../scrubber_control_from_pressed_mtrl_004.png | Bin 606 -> 0 bytes .../scrubber_control_from_pressed_mtrl_005.png | Bin 622 -> 0 bytes .../scrubber_control_off_mtrl_alpha.png | Bin 314 -> 0 bytes .../scrubber_control_off_pressed_mtrl_alpha.png | Bin 1184 -> 0 bytes .../scrubber_control_to_pressed_mtrl_000.png | Bin 619 -> 0 bytes .../scrubber_control_to_pressed_mtrl_001.png | Bin 628 -> 0 bytes .../scrubber_control_to_pressed_mtrl_002.png | Bin 714 -> 0 bytes .../scrubber_control_to_pressed_mtrl_003.png | Bin 792 -> 0 bytes .../scrubber_control_to_pressed_mtrl_004.png | Bin 798 -> 0 bytes .../scrubber_control_to_pressed_mtrl_005.png | Bin 802 -> 0 bytes .../scrubber_control_from_pressed_mtrl_000.png | Bin 1101 -> 0 bytes .../scrubber_control_from_pressed_mtrl_001.png | Bin 989 -> 0 bytes .../scrubber_control_from_pressed_mtrl_002.png | Bin 900 -> 0 bytes .../scrubber_control_from_pressed_mtrl_003.png | Bin 808 -> 0 bytes .../scrubber_control_from_pressed_mtrl_004.png | Bin 824 -> 0 bytes .../scrubber_control_from_pressed_mtrl_005.png | Bin 803 -> 0 bytes .../scrubber_control_off_mtrl_alpha.png | Bin 388 -> 0 bytes .../scrubber_control_off_pressed_mtrl_alpha.png | Bin 2227 -> 0 bytes .../scrubber_control_to_pressed_mtrl_000.png | Bin 815 -> 0 bytes .../scrubber_control_to_pressed_mtrl_001.png | Bin 847 -> 0 bytes .../scrubber_control_to_pressed_mtrl_002.png | Bin 1004 -> 0 bytes .../scrubber_control_to_pressed_mtrl_003.png | Bin 1077 -> 0 bytes .../scrubber_control_to_pressed_mtrl_004.png | Bin 1085 -> 0 bytes .../scrubber_control_to_pressed_mtrl_005.png | Bin 1134 -> 0 bytes .../scrubber_control_from_pressed_mtrl_000.png | Bin 1818 -> 0 bytes .../scrubber_control_from_pressed_mtrl_001.png | Bin 1653 -> 0 bytes .../scrubber_control_from_pressed_mtrl_002.png | Bin 1571 -> 0 bytes .../scrubber_control_from_pressed_mtrl_003.png | Bin 1471 -> 0 bytes .../scrubber_control_from_pressed_mtrl_004.png | Bin 1502 -> 0 bytes .../scrubber_control_from_pressed_mtrl_005.png | Bin 1487 -> 0 bytes .../scrubber_control_to_pressed_mtrl_000.png | Bin 1492 -> 0 bytes .../scrubber_control_to_pressed_mtrl_001.png | Bin 1507 -> 0 bytes .../scrubber_control_to_pressed_mtrl_002.png | Bin 1664 -> 0 bytes .../scrubber_control_to_pressed_mtrl_003.png | Bin 1752 -> 0 bytes .../scrubber_control_to_pressed_mtrl_004.png | Bin 1772 -> 0 bytes .../scrubber_control_to_pressed_mtrl_005.png | Bin 1858 -> 0 bytes .../res/drawable/seekbar_thumb_material_anim.xml | 87 ++++++++------------- .../seekbar_thumb_pressed_to_unpressed.xml | 38 +++++++++ ...eekbar_thumb_pressed_to_unpressed_animation.xml | 8 ++ .../seekbar_thumb_unpressed_to_pressed.xml | 36 +++++++++ ...eekbar_thumb_unpressed_to_pressed_animation.xml | 8 ++ core/res/res/drawable/seekbar_track_material.xml | 2 +- core/res/res/values/attrs.xml | 29 +++++++ core/res/res/values/styles_material.xml | 1 + .../graphics/drawable/AnimatedVectorDrawable.java | 7 ++ .../graphics/drawable/GradientDrawable.java | 19 +++++ .../android/graphics/drawable/VectorDrawable.java | 19 +++++ 82 files changed, 248 insertions(+), 68 deletions(-) create mode 100644 core/res/res/anim/seekbar_thumb_pressed_to_unpressed_thumb_animation.xml create mode 100644 core/res/res/anim/seekbar_thumb_unpressed_to_pressed_thumb_0_animation.xml delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_005.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_off_mtrl_alpha.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_off_pressed_mtrl_alpha.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_005.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_005.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_off_mtrl_alpha.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_off_pressed_mtrl_alpha.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_005.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_005.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_off_mtrl_alpha.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_off_pressed_mtrl_alpha.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_005.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_005.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_off_mtrl_alpha.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_off_pressed_mtrl_alpha.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_005.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_005.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_000.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_001.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_002.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_003.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_004.png delete mode 100644 core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_005.png create mode 100644 core/res/res/drawable/seekbar_thumb_pressed_to_unpressed.xml create mode 100644 core/res/res/drawable/seekbar_thumb_pressed_to_unpressed_animation.xml create mode 100644 core/res/res/drawable/seekbar_thumb_unpressed_to_pressed.xml create mode 100644 core/res/res/drawable/seekbar_thumb_unpressed_to_pressed_animation.xml diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index ff74c60..a4c8d1c 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -86,10 +86,10 @@ public abstract class AbsSeekBar extends ProgressBar { public AbsSeekBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.SeekBar, defStyleAttr, defStyleRes); + final TypedArray a = context.obtainStyledAttributes( + attrs, R.styleable.SeekBar, defStyleAttr, defStyleRes); - final Drawable thumb = a.getDrawable(com.android.internal.R.styleable.SeekBar_thumb); + final Drawable thumb = a.getDrawable(R.styleable.SeekBar_thumb); setThumb(thumb); if (a.hasValue(R.styleable.SeekBar_thumbTintMode)) { @@ -103,18 +103,22 @@ public abstract class AbsSeekBar extends ProgressBar { mHasThumbTint = true; } + mSplitTrack = a.getBoolean(R.styleable.SeekBar_splitTrack, false); + // Guess thumb offset if thumb != null, but allow layout to override. - final int thumbOffset = a.getDimensionPixelOffset( - com.android.internal.R.styleable.SeekBar_thumbOffset, getThumbOffset()); + final int thumbOffset = a.getDimensionPixelOffset(R.styleable.SeekBar_thumbOffset, getThumbOffset()); setThumbOffset(thumbOffset); - mSplitTrack = a.getBoolean(com.android.internal.R.styleable.SeekBar_splitTrack, false); + final boolean useDisabledAlpha = a.getBoolean(R.styleable.SeekBar_useDisabledAlpha, true); a.recycle(); - a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.Theme, 0, 0); - mDisabledAlpha = a.getFloat(com.android.internal.R.styleable.Theme_disabledAlpha, 0.5f); - a.recycle(); + if (useDisabledAlpha) { + final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.Theme, 0, 0); + mDisabledAlpha = ta.getFloat(R.styleable.Theme_disabledAlpha, 0.5f); + ta.recycle(); + } else { + mDisabledAlpha = 1.0f; + } applyThumbTint(); @@ -360,7 +364,7 @@ public abstract class AbsSeekBar extends ProgressBar { super.drawableStateChanged(); final Drawable progressDrawable = getProgressDrawable(); - if (progressDrawable != null) { + if (progressDrawable != null && mDisabledAlpha < 1.0f) { progressDrawable.setAlpha(isEnabled() ? NO_ALPHA : (int) (NO_ALPHA * mDisabledAlpha)); } diff --git a/core/res/res/anim/seekbar_thumb_pressed_to_unpressed_thumb_animation.xml b/core/res/res/anim/seekbar_thumb_pressed_to_unpressed_thumb_animation.xml new file mode 100644 index 0000000..081b552 --- /dev/null +++ b/core/res/res/anim/seekbar_thumb_pressed_to_unpressed_thumb_animation.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/core/res/res/anim/seekbar_thumb_unpressed_to_pressed_thumb_0_animation.xml b/core/res/res/anim/seekbar_thumb_unpressed_to_pressed_thumb_0_animation.xml new file mode 100644 index 0000000..41e5a44 --- /dev/null +++ b/core/res/res/anim/seekbar_thumb_unpressed_to_pressed_thumb_0_animation.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_000.png b/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_000.png deleted file mode 100644 index 281923e..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_001.png b/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_001.png deleted file mode 100644 index e91d4fb..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_002.png b/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_002.png deleted file mode 100644 index 15baded..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_003.png b/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_003.png deleted file mode 100644 index 3d5899f..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_004.png b/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_004.png deleted file mode 100644 index e2277bd..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_005.png b/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_005.png deleted file mode 100644 index b502e22..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_from_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_off_mtrl_alpha.png b/core/res/res/drawable-hdpi/scrubber_control_off_mtrl_alpha.png deleted file mode 100644 index 5a99528..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_off_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_off_pressed_mtrl_alpha.png b/core/res/res/drawable-hdpi/scrubber_control_off_pressed_mtrl_alpha.png deleted file mode 100644 index 10ce2bc..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_off_pressed_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_000.png b/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_000.png deleted file mode 100644 index a70be2c..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_001.png b/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_001.png deleted file mode 100644 index 9442316..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_002.png b/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_002.png deleted file mode 100644 index 33db4a88..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_003.png b/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_003.png deleted file mode 100644 index 4e1cd16..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_004.png b/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_004.png deleted file mode 100644 index d5254f4..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_005.png b/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_005.png deleted file mode 100644 index 7aa0a3e..0000000 Binary files a/core/res/res/drawable-hdpi/scrubber_control_to_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_000.png b/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_000.png deleted file mode 100644 index 377a6b4..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_001.png b/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_001.png deleted file mode 100644 index 0859f62..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_002.png b/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_002.png deleted file mode 100644 index bf5cdcd..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_003.png b/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_003.png deleted file mode 100644 index 4cd177d..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_004.png b/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_004.png deleted file mode 100644 index dfe39ca..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_005.png b/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_005.png deleted file mode 100644 index 5d3ab99..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_from_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_off_mtrl_alpha.png b/core/res/res/drawable-mdpi/scrubber_control_off_mtrl_alpha.png deleted file mode 100644 index e40cba8..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_off_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_off_pressed_mtrl_alpha.png b/core/res/res/drawable-mdpi/scrubber_control_off_pressed_mtrl_alpha.png deleted file mode 100644 index 1f4b46a..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_off_pressed_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_000.png b/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_000.png deleted file mode 100644 index 80922eb..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_001.png b/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_001.png deleted file mode 100644 index aa77044..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_002.png b/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_002.png deleted file mode 100644 index 7b099db..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_003.png b/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_003.png deleted file mode 100644 index 088c86a..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_004.png b/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_004.png deleted file mode 100644 index 3c6b9bc..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_005.png b/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_005.png deleted file mode 100644 index adf5100..0000000 Binary files a/core/res/res/drawable-mdpi/scrubber_control_to_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_000.png b/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_000.png deleted file mode 100644 index ea09a31..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_001.png b/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_001.png deleted file mode 100644 index f9a4391..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_002.png b/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_002.png deleted file mode 100644 index d9606e1..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_003.png b/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_003.png deleted file mode 100644 index df2d9d0..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_004.png b/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_004.png deleted file mode 100644 index 625a322..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_005.png b/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_005.png deleted file mode 100644 index 79e8dde..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_from_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_off_mtrl_alpha.png b/core/res/res/drawable-xhdpi/scrubber_control_off_mtrl_alpha.png deleted file mode 100644 index 729e0bf..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_off_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_off_pressed_mtrl_alpha.png b/core/res/res/drawable-xhdpi/scrubber_control_off_pressed_mtrl_alpha.png deleted file mode 100644 index 754b321..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_off_pressed_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_000.png b/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_000.png deleted file mode 100644 index e99c266..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_001.png b/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_001.png deleted file mode 100644 index f0329a4..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_002.png b/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_002.png deleted file mode 100644 index 42c40b7..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_003.png b/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_003.png deleted file mode 100644 index 807491f..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_004.png b/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_004.png deleted file mode 100644 index dfec9cc..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_005.png b/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_005.png deleted file mode 100644 index 0ed59ea..0000000 Binary files a/core/res/res/drawable-xhdpi/scrubber_control_to_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_000.png b/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_000.png deleted file mode 100644 index 46aa533..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_001.png b/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_001.png deleted file mode 100644 index a749469..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_002.png b/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_002.png deleted file mode 100644 index ef43f00..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_003.png b/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_003.png deleted file mode 100644 index eebddc3..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_004.png b/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_004.png deleted file mode 100644 index 44b654d..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_005.png b/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_005.png deleted file mode 100644 index 6e768c1..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_from_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_off_mtrl_alpha.png b/core/res/res/drawable-xxhdpi/scrubber_control_off_mtrl_alpha.png deleted file mode 100644 index a2b5716..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_off_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_off_pressed_mtrl_alpha.png b/core/res/res/drawable-xxhdpi/scrubber_control_off_pressed_mtrl_alpha.png deleted file mode 100644 index 0319bd8..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_off_pressed_mtrl_alpha.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_000.png b/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_000.png deleted file mode 100644 index 2ac6dae..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_001.png b/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_001.png deleted file mode 100644 index 91c49ce..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_002.png b/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_002.png deleted file mode 100644 index 4b4bd1f..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_003.png b/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_003.png deleted file mode 100644 index 637e596..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_004.png b/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_004.png deleted file mode 100644 index 42d4d2a..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_005.png b/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_005.png deleted file mode 100644 index 995d1b2..0000000 Binary files a/core/res/res/drawable-xxhdpi/scrubber_control_to_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_000.png b/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_000.png deleted file mode 100644 index 0c8f746..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_001.png b/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_001.png deleted file mode 100644 index 5db9deb..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_002.png b/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_002.png deleted file mode 100644 index 3aca6d3..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_003.png b/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_003.png deleted file mode 100644 index 746c74f..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_004.png b/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_004.png deleted file mode 100644 index 454a5b2..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_005.png b/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_005.png deleted file mode 100644 index 80ad8cc..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_from_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_000.png b/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_000.png deleted file mode 100644 index cfd0db4..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_000.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_001.png b/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_001.png deleted file mode 100644 index 845092f..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_001.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_002.png b/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_002.png deleted file mode 100644 index 0042db4..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_002.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_003.png b/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_003.png deleted file mode 100644 index 77b2901..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_003.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_004.png b/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_004.png deleted file mode 100644 index fb3c238..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_004.png and /dev/null differ diff --git a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_005.png b/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_005.png deleted file mode 100644 index 0d28c45..0000000 Binary files a/core/res/res/drawable-xxxhdpi/scrubber_control_to_pressed_mtrl_005.png and /dev/null differ diff --git a/core/res/res/drawable/seekbar_thumb_material_anim.xml b/core/res/res/drawable/seekbar_thumb_material_anim.xml index 4b13259..9726e73 100644 --- a/core/res/res/drawable/seekbar_thumb_material_anim.xml +++ b/core/res/res/drawable/seekbar_thumb_material_anim.xml @@ -1,5 +1,5 @@ - - - - - + - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/core/res/res/drawable/seekbar_thumb_pressed_to_unpressed.xml b/core/res/res/drawable/seekbar_thumb_pressed_to_unpressed.xml new file mode 100644 index 0000000..c2c678af --- /dev/null +++ b/core/res/res/drawable/seekbar_thumb_pressed_to_unpressed.xml @@ -0,0 +1,38 @@ + + + + + + + + diff --git a/core/res/res/drawable/seekbar_thumb_pressed_to_unpressed_animation.xml b/core/res/res/drawable/seekbar_thumb_pressed_to_unpressed_animation.xml new file mode 100644 index 0000000..6a2da7d --- /dev/null +++ b/core/res/res/drawable/seekbar_thumb_pressed_to_unpressed_animation.xml @@ -0,0 +1,8 @@ + + + + diff --git a/core/res/res/drawable/seekbar_thumb_unpressed_to_pressed.xml b/core/res/res/drawable/seekbar_thumb_unpressed_to_pressed.xml new file mode 100644 index 0000000..8040018 --- /dev/null +++ b/core/res/res/drawable/seekbar_thumb_unpressed_to_pressed.xml @@ -0,0 +1,36 @@ + + + + + + + + diff --git a/core/res/res/drawable/seekbar_thumb_unpressed_to_pressed_animation.xml b/core/res/res/drawable/seekbar_thumb_unpressed_to_pressed_animation.xml new file mode 100644 index 0000000..1c2b3a9 --- /dev/null +++ b/core/res/res/drawable/seekbar_thumb_unpressed_to_pressed_animation.xml @@ -0,0 +1,8 @@ + + + + diff --git a/core/res/res/drawable/seekbar_track_material.xml b/core/res/res/drawable/seekbar_track_material.xml index 01eb243..6e40c48 100644 --- a/core/res/res/drawable/seekbar_track_material.xml +++ b/core/res/res/drawable/seekbar_track_material.xml @@ -20,7 +20,7 @@ - + + + @@ -5117,6 +5122,18 @@ + + + + + + + + @@ -5578,6 +5595,18 @@ + + + + + + + + diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index 56eafe1..f9fcf38 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -721,6 +721,7 @@ please see styles_device_defaults.xml. @drawable/seekbar_track_material @drawable/seekbar_thumb_material_anim true + false true 16dip 16dip diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java index b8f64a4..d0535e7 100644 --- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java @@ -25,6 +25,7 @@ import android.content.res.Resources.Theme; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.ColorFilter; +import android.graphics.Insets; import android.graphics.Outline; import android.graphics.PorterDuff; import android.graphics.Rect; @@ -271,6 +272,12 @@ public class AnimatedVectorDrawable extends Drawable implements Animatable { mAnimatedVectorState.mVectorDrawable.getOutline(outline); } + /** @hide */ + @Override + public Insets getOpticalInsets() { + return mAnimatedVectorState.mVectorDrawable.getOpticalInsets(); + } + @Override public void inflate(Resources res, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException { diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java index 4c2817c..ed47eed 100644 --- a/graphics/java/android/graphics/drawable/GradientDrawable.java +++ b/graphics/java/android/graphics/drawable/GradientDrawable.java @@ -25,6 +25,7 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.DashPathEffect; +import android.graphics.Insets; import android.graphics.LinearGradient; import android.graphics.Outline; import android.graphics.Paint; @@ -1107,6 +1108,16 @@ public class GradientDrawable extends Drawable { if (tint != null) { state.mTint = tint; } + + final int insetLeft = a.getDimensionPixelSize( + R.styleable.GradientDrawable_opticalInsetLeft, state.mOpticalInsets.left); + final int insetTop = a.getDimensionPixelSize( + R.styleable.GradientDrawable_opticalInsetTop, state.mOpticalInsets.top); + final int insetRight = a.getDimensionPixelSize( + R.styleable.GradientDrawable_opticalInsetRight, state.mOpticalInsets.right); + final int insetBottom = a.getDimensionPixelSize( + R.styleable.GradientDrawable_opticalInsetBottom, state.mOpticalInsets.bottom); + state.mOpticalInsets = Insets.of(insetLeft, insetTop, insetRight, insetBottom); } @Override @@ -1469,6 +1480,12 @@ public class GradientDrawable extends Drawable { return mGradientState.mHeight; } + /** @hide */ + @Override + public Insets getOpticalInsets() { + return mGradientState.mOpticalInsets; + } + @Override public ConstantState getConstantState() { mGradientState.mChangingConfigurations = getChangingConfigurations(); @@ -1573,6 +1590,7 @@ public class GradientDrawable extends Drawable { public int mInnerRadius = -1; public int mThickness = -1; public boolean mDither = false; + public Insets mOpticalInsets = Insets.NONE; float mCenterX = 0.5f; float mCenterY = 0.5f; @@ -1631,6 +1649,7 @@ public class GradientDrawable extends Drawable { mInnerRadius = state.mInnerRadius; mThickness = state.mThickness; mDither = state.mDither; + mOpticalInsets = state.mOpticalInsets; mCenterX = state.mCenterX; mCenterY = state.mCenterY; mGradientRadius = state.mGradientRadius; diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java index f4df14e..b9f3f2a 100644 --- a/graphics/java/android/graphics/drawable/VectorDrawable.java +++ b/graphics/java/android/graphics/drawable/VectorDrawable.java @@ -23,6 +23,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; +import android.graphics.Insets; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; @@ -361,6 +362,12 @@ public class VectorDrawable extends Drawable { return (int) mVectorState.mVPathRenderer.mBaseHeight; } + /** @hide */ + @Override + public Insets getOpticalInsets() { + return mVectorState.mVPathRenderer.mOpticalInsets; + } + @Override public boolean canApplyTheme() { return (mVectorState != null && mVectorState.canApplyTheme()) || super.canApplyTheme(); @@ -524,6 +531,16 @@ public class VectorDrawable extends Drawable { " tag requires height > 0"); } + final int insetLeft = a.getDimensionPixelSize( + R.styleable.VectorDrawable_opticalInsetLeft, pathRenderer.mOpticalInsets.left); + final int insetTop = a.getDimensionPixelSize( + R.styleable.VectorDrawable_opticalInsetTop, pathRenderer.mOpticalInsets.top); + final int insetRight = a.getDimensionPixelSize( + R.styleable.VectorDrawable_opticalInsetRight, pathRenderer.mOpticalInsets.right); + final int insetBottom = a.getDimensionPixelSize( + R.styleable.VectorDrawable_opticalInsetBottom, pathRenderer.mOpticalInsets.bottom); + pathRenderer.mOpticalInsets = Insets.of(insetLeft, insetTop, insetRight, insetBottom); + final float alphaInFloat = a.getFloat(R.styleable.VectorDrawable_alpha, pathRenderer.getAlpha()); pathRenderer.setAlpha(alphaInFloat); @@ -821,6 +838,7 @@ public class VectorDrawable extends Drawable { float mBaseHeight = 0; float mViewportWidth = 0; float mViewportHeight = 0; + Insets mOpticalInsets = Insets.NONE; int mRootAlpha = 0xFF; String mRootName = null; @@ -859,6 +877,7 @@ public class VectorDrawable extends Drawable { mBaseHeight = copy.mBaseHeight; mViewportWidth = copy.mViewportWidth; mViewportHeight = copy.mViewportHeight; + mOpticalInsets = copy.mOpticalInsets; mChangingConfigurations = copy.mChangingConfigurations; mRootAlpha = copy.mRootAlpha; mRootName = copy.mRootName; -- cgit v1.1