summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/Paint.java17
-rw-r--r--graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java4
-rw-r--r--graphics/java/android/graphics/drawable/VectorDrawable.java16
3 files changed, 31 insertions, 6 deletions
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 916cb5a..1e1128e 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -500,6 +500,7 @@ public class Paint {
mBidiFlags = BIDI_DEFAULT_LTR;
setTextLocale(Locale.getDefault());
+ setElegantTextHeight(false);
}
/**
@@ -1221,6 +1222,22 @@ public class Paint {
}
/**
+ * Get the elegant metrics flag.
+ *
+ * @return true if elegant metrics are enabled for text drawing.
+ */
+ public native boolean isElegantTextHeight();
+
+ /**
+ * Set the paint's elegant height metrics flag. This setting selects font
+ * variants that have not been compacted to fit Latin-based vertical
+ * metrics, and also increases top and bottom bounds to provide more space.
+ *
+ * @param elegant set the paint's elegant metrics flag for drawing text.
+ */
+ public native void setElegantTextHeight(boolean elegant);
+
+ /**
* Return the paint's text size.
*
* @return the paint's text size.
diff --git a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
index 3773a49..5f59467 100644
--- a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
+++ b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
@@ -44,6 +44,8 @@ import java.io.IOException;
* Documentation pending.
*/
public class TouchFeedbackDrawable extends LayerDrawable {
+ private static final PorterDuffXfermode DST_IN = new PorterDuffXfermode(Mode.DST_IN);
+
/** The maximum number of ripples supported. */
private static final int MAX_RIPPLES = 10;
@@ -397,7 +399,7 @@ public class TouchFeedbackDrawable extends LayerDrawable {
if (mask != null && drewRipples) {
// TODO: This will also mask the lower layer, which is bad.
canvas.saveLayer(bounds.left, bounds.top, bounds.right,
- bounds.bottom, getMaskingPaint(mState.mTintXfermode), 0);
+ bounds.bottom, getMaskingPaint(DST_IN), 0);
mask.draw(canvas);
}
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;
}