summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-04-16 16:57:53 -0700
committerAlan Viverette <alanv@google.com>2014-04-16 16:58:58 -0700
commit70802d2501dd5607ca0f38d7aa36771d9e0c7b20 (patch)
tree205266995ff7fcdd92999f68387bd9ccc05c4bbf
parent8aa68921a577e1b665fe61cb40d3c929054a0a94 (diff)
downloadframeworks_base-70802d2501dd5607ca0f38d7aa36771d9e0c7b20.zip
frameworks_base-70802d2501dd5607ca0f38d7aa36771d9e0c7b20.tar.gz
frameworks_base-70802d2501dd5607ca0f38d7aa36771d9e0c7b20.tar.bz2
Fix VectorDrawable states
BUG: 14083130 Change-Id: I8242523d9a4acd499154d2e7b9b9b52a3f1f742d
-rw-r--r--core/res/res/drawable/btn_check_quantum_anim.xml40
-rw-r--r--graphics/java/android/graphics/drawable/VectorDrawable.java16
2 files changed, 31 insertions, 25 deletions
diff --git a/core/res/res/drawable/btn_check_quantum_anim.xml b/core/res/res/drawable/btn_check_quantum_anim.xml
index d68d512..0600522 100644
--- a/core/res/res/drawable/btn_check_quantum_anim.xml
+++ b/core/res/res/drawable/btn_check_quantum_anim.xml
@@ -27,24 +27,27 @@
<group>
<path
- android:name="check"
- android:pathData="M 232.1,80.6 L 248.5,92.1 L 145.2,239.5 L 71.5,187.8 L 83,171.5 L 140.3,211.7 z"
- android:fill="?attr/colorControlActivated" />
+ android:name="box1"
+ android:pathData="M 240,80 L 240,240 L 80,240 L 80,80 L 240,80 L 240,80 z"
+ android:stroke="?attr/colorControlNormal"
+ android:strokeWidth="20"
+ android:strokeLineCap="round"
+ android:strokeLineJoin="round" />
</group>
<group>
<path
- android:name="box1"
- android:pathData="M 160,216.5 L 143.5,240 L 120,223.5 L 136.5,200 L 160,216.5 L 160,216.5 z"
- android:fill="?attr/colorControlActivated"
- android:stroke="?attr/colorControlActivated"
+ android:name="box2"
+ android:pathData="M 160,200 L 160,240 L 120,240 L 120,200 L 160,200 L 160,200 z"
+ android:stroke="?attr/colorControlNormal"
+ android:strokeWidth="10"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</group>
<group>
<path
- android:name="box2"
+ android:name="box3"
android:pathData="M 160,216.5 L 143.5,240 L 120,223.5 L 136.5,200 L 160,216.5 L 160,216.5 z"
- android:rotation="-35"
+ android:rotation="35"
android:pivotX="140"
android:pivotY="220"
android:fill="?attr/colorControlNormal"
@@ -55,25 +58,22 @@
</group>
<group>
<path
- android:name="box3"
- android:pathData="M 160,200 L 160,240 L 120,240 L 120,200 L 160,200 L 160,200 z"
- android:stroke="?attr/colorControlNormal"
- android:strokeWidth="10"
+ android:name="box4"
+ android:pathData="M 160,216.5 L 143.5,240 L 120,223.5 L 136.5,200 L 160,216.5 L 160,216.5 z"
+ android:fill="?attr/colorControlActivated"
+ android:stroke="?attr/colorControlActivated"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</group>
<group>
<path
- android:name="box4"
- android:pathData="M 240,80 L 240,240 L 80,240 L 80,80 L 240,80 L 240,80 z"
- android:stroke="?attr/colorControlNormal"
- android:strokeWidth="20"
- android:strokeLineCap="round"
- android:strokeLineJoin="round" />
+ android:name="check"
+ android:pathData="M 232.1,80.6 L 248.5,92.1 L 145.2,239.5 L 71.5,187.8 L 83,171.5 L 140.3,211.7 z"
+ android:fill="?attr/colorControlActivated" />
</group>
<animation
android:durations="300,100,0,300"
- android:sequence="check,box1,box2,box3,box4" />
+ android:sequence="box1,box2,box3,box4,check" />
</vector>
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index 736b143..0992717 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -182,14 +182,14 @@ public class VectorDrawable extends Drawable {
public VectorDrawable() {
mVectorState = new VectorDrawableState(null);
- mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 1);
+ mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 0);
setDuration(DEFAULT_DURATION);
}
private VectorDrawable(VectorDrawableState state, Resources res, Theme theme) {
mVectorState = new VectorDrawableState(state);
- mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 1);
+ mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 0);
if (theme != null && canApplyTheme()) {
applyTheme(theme);
@@ -213,7 +213,7 @@ public class VectorDrawable extends Drawable {
@Override
public void jumpToCurrentState() {
- mVectorState.mBasicAnimator.end();
+ stop();
}
/**
@@ -318,7 +318,7 @@ public class VectorDrawable extends Drawable {
private void animateBackward() {
if (!mVectorState.mBasicAnimator.isStarted()) {
- mVectorState.mBasicAnimator.setFloatValues(.99f, 0);
+ mVectorState.mBasicAnimator.setFloatValues(1, 0);
start();
}
}
@@ -985,7 +985,13 @@ public class VectorDrawable extends Drawable {
for (int j = 0; j < sp.length; j++) {
mSeqMap.add(sp[j].trim());
- VectorDrawable.VPath path = groups.get(j).get(sp[j]);
+
+ final VectorDrawable.VPath path = groups.get(j).get(sp[j]);
+ if (path == null) {
+ throw new XmlPullParserException(a.getPositionDescription()
+ + " missing path with name: " + sp[j]);
+ }
+
path.mAnimated = true;
paths[j] = path;
}