summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2014-08-16 02:06:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-15 21:23:40 +0000
commitc13ff2e4f54abc61313e906b6854986bfa96bf1e (patch)
treeee51831f4834df87df5dd7451137f2318b21f167 /graphics
parentaeda0586f3a005193bd85409bc1ef998ae4d8a34 (diff)
parent2e1c9b517ec7b075280125b435b3bfb99b02cf59 (diff)
downloadframeworks_base-c13ff2e4f54abc61313e906b6854986bfa96bf1e.zip
frameworks_base-c13ff2e4f54abc61313e906b6854986bfa96bf1e.tar.gz
frameworks_base-c13ff2e4f54abc61313e906b6854986bfa96bf1e.tar.bz2
Merge "Revert "Throw exception when inset drawable is missing drawable attribute"" into lmp-dev
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/InsetDrawable.java35
1 files changed, 14 insertions, 21 deletions
diff --git a/graphics/java/android/graphics/drawable/InsetDrawable.java b/graphics/java/android/graphics/drawable/InsetDrawable.java
index 3359ebc..588e776 100644
--- a/graphics/java/android/graphics/drawable/InsetDrawable.java
+++ b/graphics/java/android/graphics/drawable/InsetDrawable.java
@@ -26,13 +26,10 @@ import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.Resources.Theme;
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.Insets;
-import android.graphics.Outline;
+import android.graphics.*;
import android.graphics.PorterDuff.Mode;
-import android.graphics.Rect;
import android.util.AttributeSet;
+import android.util.Log;
import java.io.IOException;
@@ -53,6 +50,8 @@ import java.io.IOException;
* @attr ref android.R.styleable#InsetDrawable_insetBottom
*/
public class InsetDrawable extends Drawable implements Drawable.Callback {
+ private static final String LOG_TAG = "InsetDrawable";
+
private final Rect mTmpRect = new Rect();
private InsetState mInsetState;
@@ -87,6 +86,7 @@ public class InsetDrawable extends Drawable implements Drawable.Callback {
final TypedArray a = r.obtainAttributes(attrs, R.styleable.InsetDrawable);
super.inflateWithAttributes(r, parser, a, R.styleable.InsetDrawable_visible);
updateStateFromTypedArray(a);
+ a.recycle();
// Load inner XML elements.
if (mInsetState.mDrawable == null) {
@@ -104,19 +104,9 @@ public class InsetDrawable extends Drawable implements Drawable.Callback {
dr.setCallback(this);
}
- verifyRequiredAttributes(a);
- a.recycle();
- }
-
- private void verifyRequiredAttributes(TypedArray a) throws XmlPullParserException {
- // If we're not waiting on a theme, verify required attributes.
- if (mInsetState.mThemeAttrs == null) {
- if (mInsetState.mThemeAttrs[R.styleable.InsetDrawable_drawable] != 0
- && mInsetState.mDrawable == null) {
- throw new XmlPullParserException(a.getPositionDescription() +
- ": <inset> tag requires a 'drawable' attribute or "
- + "child tag defining a drawable");
- }
+ // Verify state.
+ if (mInsetState.mDrawable == null) {
+ Log.w(LOG_TAG, "No drawable specified for <inset>");
}
}
@@ -177,7 +167,6 @@ public class InsetDrawable extends Drawable implements Drawable.Callback {
final TypedArray a = t.resolveAttributes(state.mThemeAttrs, R.styleable.InsetDrawable);
try {
updateStateFromTypedArray(a);
- verifyRequiredAttributes(a);
} catch (XmlPullParserException e) {
throw new RuntimeException(e);
} finally {
@@ -235,8 +224,12 @@ public class InsetDrawable extends Drawable implements Drawable.Callback {
padding.top += mInsetState.mInsetTop;
padding.bottom += mInsetState.mInsetBottom;
- return pad || (mInsetState.mInsetLeft | mInsetState.mInsetRight |
- mInsetState.mInsetTop | mInsetState.mInsetBottom) != 0;
+ if (pad || (mInsetState.mInsetLeft | mInsetState.mInsetRight |
+ mInsetState.mInsetTop | mInsetState.mInsetBottom) != 0) {
+ return true;
+ } else {
+ return false;
+ }
}
/** @hide */