summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-01-10 22:52:42 +0000
committerAlan Viverette <alanv@google.com>2014-01-10 22:52:42 +0000
commit218974915a25b2f9dd2e9543aceda16b26505280 (patch)
tree8e1615a6c34c76773141348e97967ec6c6627c6a /graphics
parent8f164f64ec55a973fc043de932d853dd41772e4e (diff)
downloadframeworks_base-218974915a25b2f9dd2e9543aceda16b26505280.zip
frameworks_base-218974915a25b2f9dd2e9543aceda16b26505280.tar.gz
frameworks_base-218974915a25b2f9dd2e9543aceda16b26505280.tar.bz2
Revert "Fixing Drawable methods for find by layer ID and invalidation callback"
This reverts commit 8f164f64ec55a973fc043de932d853dd41772e4e. Change-Id: I35637dee7b58c77387f375de585713ff76d4dd87
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/LayerDrawable.java20
1 files changed, 9 insertions, 11 deletions
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java
index 7f00e50..f2e9988 100644
--- a/graphics/java/android/graphics/drawable/LayerDrawable.java
+++ b/graphics/java/android/graphics/drawable/LayerDrawable.java
@@ -229,18 +229,15 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
}
/**
- * Looks for a layer with the given ID and returns its {@link Drawable}.
- * <p>
- * If multiple layers are found for the given ID, returns the
- * {@link Drawable} for the matching layer at the highest index.
+ * Look for a layer with the given id, and returns its {@link Drawable}.
*
* @param id The layer ID to search for.
- * @return The {@link Drawable} for the highest-indexed layer that has the
- * given ID, or null if not found.
+ * @return The {@link Drawable} of the layer that has the given id in the hierarchy or null.
*/
public Drawable findDrawableByLayerId(int id) {
final ChildDrawable[] layers = mLayerState.mChildren;
- for (int i = mLayerState.mNum - 1; i >= 0; i--) {
+ final int N = mLayerState.mNum;
+ for (int i = 0; i < N; i++) {
if (layers[i].mId == id) {
return layers[i].mDrawable;
}
@@ -373,7 +370,7 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
}
/**
- * Invalidates cached padding and recomputes child bounds.
+ * Invalidates cached padding.
*/
private void invalidatePadding() {
mHasCachedPadding = false;
@@ -382,9 +379,10 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
@Override
public void invalidateDrawable(Drawable who) {
- // Something changed, maybe it was the child drawable's padding.
- invalidatePadding();
- invalidateSelf();
+ final Callback callback = getCallback();
+ if (callback != null) {
+ callback.invalidateDrawable(this);
+ }
}
@Override