summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-05-29 15:12:14 -0700
committerAlan Viverette <alanv@google.com>2015-05-29 15:12:14 -0700
commit87e1938be8e6c2ac7e6163a63df5dd69633cc836 (patch)
treec4eb23c5d1e683ffd2fe36307b8dc529f49629b3 /graphics
parent517f3ee41afb7713f1fc6fa37a6f3a6efa97a020 (diff)
downloadframeworks_base-87e1938be8e6c2ac7e6163a63df5dd69633cc836.zip
frameworks_base-87e1938be8e6c2ac7e6163a63df5dd69633cc836.tar.gz
frameworks_base-87e1938be8e6c2ac7e6163a63df5dd69633cc836.tar.bz2
Replace PNG-based seekbar thumb animation with AVD
Adds optical inset support for VectorDrawable and GradientDrawable. Bug: 19944181 Change-Id: I9df04d9fe17ad858413e7f93694bf37ee2c43c85
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java7
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java19
-rw-r--r--graphics/java/android/graphics/drawable/VectorDrawable.java19
3 files changed, 45 insertions, 0 deletions
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 {
"<vector> 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;