diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2012-06-11 18:30:05 -0700 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2012-09-06 18:05:02 -0700 |
commit | 0af4b8b0c8b038bca9b4f60eb81f71e186f471ce (patch) | |
tree | 74293a4499e25a372b6ef0c7c6a291906af3d619 /graphics | |
parent | 18e876806718e28edaa3cd9bb0262a9b400bc82b (diff) | |
download | frameworks_base-0af4b8b0c8b038bca9b4f60eb81f71e186f471ce.zip frameworks_base-0af4b8b0c8b038bca9b4f60eb81f71e186f471ce.tar.gz frameworks_base-0af4b8b0c8b038bca9b4f60eb81f71e186f471ce.tar.bz2 |
Make ProgressBar / SeekBar / RatingBar widgets aware of layout direction
- see bug #5429822 UI should be mirrored for RTL locales (Arabic, Hebrew, farsi)
Change-Id: I8d76299090abf6b2b187696b1a83e71d7a44b1ce
Diffstat (limited to 'graphics')
3 files changed, 26 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/drawable/ClipDrawable.java b/graphics/java/android/graphics/drawable/ClipDrawable.java index bade9b4..723db6e 100644 --- a/graphics/java/android/graphics/drawable/ClipDrawable.java +++ b/graphics/java/android/graphics/drawable/ClipDrawable.java @@ -239,7 +239,11 @@ public class ClipDrawable extends Drawable implements Drawable.Callback { return null; } - + @Override + public void setLayoutDirection(int layoutDirection) { + mClipState.mDrawable.setLayoutDirection(layoutDirection); + super.setLayoutDirection(layoutDirection); + } final static class ClipState extends ConstantState { Drawable mDrawable; diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java index 383fe71..03531ac 100644 --- a/graphics/java/android/graphics/drawable/LayerDrawable.java +++ b/graphics/java/android/graphics/drawable/LayerDrawable.java @@ -590,6 +590,18 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { return this; } + @Override + public void setLayoutDirection(int layoutDirection) { + if (getLayoutDirection() != layoutDirection) { + final ChildDrawable[] array = mLayerState.mChildren; + final int N = mLayerState.mNum; + for (int i = 0; i < N; i++) { + array[i].mDrawable.setLayoutDirection(layoutDirection); + } + } + super.setLayoutDirection(layoutDirection); + } + static class ChildDrawable { public Drawable mDrawable; public int mInsetL, mInsetT, mInsetR, mInsetB; diff --git a/graphics/java/android/graphics/drawable/StateListDrawable.java b/graphics/java/android/graphics/drawable/StateListDrawable.java index 384ca81..a5c3614 100644 --- a/graphics/java/android/graphics/drawable/StateListDrawable.java +++ b/graphics/java/android/graphics/drawable/StateListDrawable.java @@ -261,6 +261,15 @@ public class StateListDrawable extends DrawableContainer { return this; } + @Override + public void setLayoutDirection(int layoutDirection) { + final int numStates = getStateCount(); + for (int i = 0; i < numStates; i++) { + getStateDrawable(i).setLayoutDirection(layoutDirection); + } + super.setLayoutDirection(layoutDirection); + } + static final class StateListState extends DrawableContainerState { int[][] mStateSets; |