summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-03-27 22:33:21 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-27 22:33:21 +0000
commit19fccb2d850b2973d35a14e5cf1c977204fe6737 (patch)
tree514717c5de09d32b2144062eb7321c9c528ed0b7
parent9fa517423a27507f92f5ab53827987af8c3d3346 (diff)
parent433ee012363e86d9e2111684989b862bc952150f (diff)
downloadframeworks_base-19fccb2d850b2973d35a14e5cf1c977204fe6737.zip
frameworks_base-19fccb2d850b2973d35a14e5cf1c977204fe6737.tar.gz
frameworks_base-19fccb2d850b2973d35a14e5cf1c977204fe6737.tar.bz2
am 433ee012: Merge "Allow a null tint in TouchFeedbackDrawable"
* commit '433ee012363e86d9e2111684989b862bc952150f': Allow a null tint in TouchFeedbackDrawable
-rw-r--r--graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
index b66d86d..64de95f 100644
--- a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
+++ b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
@@ -39,7 +39,6 @@ import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
-import java.util.ArrayList;
/**
* Documentation pending.
@@ -98,7 +97,7 @@ public class TouchFeedbackDrawable extends LayerDrawable {
protected boolean onStateChange(int[] stateSet) {
super.onStateChange(stateSet);
- if (mRipplePaint != null) {
+ if (mRipplePaint != null && mState.mTint != null) {
final ColorStateList stateList = mState.mTint;
final int newColor = stateList.getColorForState(stateSet, 0);
final int oldColor = mRipplePaint.getColor();
@@ -122,7 +121,7 @@ public class TouchFeedbackDrawable extends LayerDrawable {
@Override
public boolean isStateful() {
- return super.isStateful() || mState.mTint.isStateful();
+ return super.isStateful() || mState.mTint != null && mState.mTint.isStateful();
}
@Override
@@ -150,10 +149,6 @@ public class TouchFeedbackDrawable extends LayerDrawable {
if (themeAttrs == null || themeAttrs[R.styleable.TouchFeedbackDrawable_tint] == 0) {
mState.mTint = a.getColorStateList(R.styleable.TouchFeedbackDrawable_tint);
-
- if (mState.mTint == null) {
- throw new RuntimeException("<touch-feedback> tag requires a 'tint' attribute");
- }
}
if (themeAttrs == null || themeAttrs[R.styleable.TouchFeedbackDrawable_tintMode] == 0) {
@@ -400,9 +395,11 @@ public class TouchFeedbackDrawable extends LayerDrawable {
if (mRipplePaint == null) {
mRipplePaint = new Paint();
mRipplePaint.setAntiAlias(true);
-
- final int color = mState.mTint.getColorForState(getState(), Color.TRANSPARENT);
- mRipplePaint.setColor(color);
+
+ if (mState.mTint != null) {
+ final int color = mState.mTint.getColorForState(getState(), Color.TRANSPARENT);
+ mRipplePaint.setColor(color);
+ }
}
return mRipplePaint;
}