summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-06-17 21:31:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-17 21:31:06 +0000
commit67b5a68088627394fd60baeeb54b78d7e68ba7b2 (patch)
treea8901260d23986c06c5b89d18c6b1953e0ea59da /graphics/java
parenta7f4d74296a67524fc0bf3442eec680cea962373 (diff)
parent536652fe91d10e5baebe0f9ca5d7e21c88ae9d9e (diff)
downloadframeworks_base-67b5a68088627394fd60baeeb54b78d7e68ba7b2.zip
frameworks_base-67b5a68088627394fd60baeeb54b78d7e68ba7b2.tar.gz
frameworks_base-67b5a68088627394fd60baeeb54b78d7e68ba7b2.tar.bz2
Merge "Resolve start/end insets in LayerDrawable.getIntrinsicWidth()" into mnc-dev
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/drawable/LayerDrawable.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java
index 0095aca..90891f6 100644
--- a/graphics/java/android/graphics/drawable/LayerDrawable.java
+++ b/graphics/java/android/graphics/drawable/LayerDrawable.java
@@ -1537,8 +1537,23 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
continue;
}
+ // Take the resolved layout direction into account. If start / end
+ // padding are defined, they will be resolved (hence overriding) to
+ // left / right or right / left depending on the resolved layout
+ // direction. If start / end padding are not defined, use the
+ // left / right ones.
+ final int insetL, insetR;
+ final int layoutDirection = getLayoutDirection();
+ if (layoutDirection == LayoutDirection.RTL) {
+ insetL = r.mInsetE == UNDEFINED_INSET ? r.mInsetL : r.mInsetE;
+ insetR = r.mInsetS == UNDEFINED_INSET ? r.mInsetR : r.mInsetS;
+ } else {
+ insetL = r.mInsetS == UNDEFINED_INSET ? r.mInsetL : r.mInsetS;
+ insetR = r.mInsetE == UNDEFINED_INSET ? r.mInsetR : r.mInsetE;
+ }
+
final int minWidth = r.mWidth < 0 ? r.mDrawable.getIntrinsicWidth() : r.mWidth;
- final int w = minWidth + r.mInsetL + r.mInsetR + padL + padR;
+ final int w = minWidth + insetL + insetR + padL + padR;
if (w > width) {
width = w;
}