diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2012-09-25 15:58:55 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-25 15:58:56 -0700 |
commit | e8e98704f3ac7b7d4070d4faabc56312efaea9bd (patch) | |
tree | ee3c25936b19ead3eafe76755ecb470099f0c6bb /core/java/android/widget/ProgressBar.java | |
parent | e79275a9f6d5215fd9b833f8921939c0993389f2 (diff) | |
parent | 7fb98b34492012aad10d1c5bcaaa4064c7a79760 (diff) | |
download | frameworks_base-e8e98704f3ac7b7d4070d4faabc56312efaea9bd.zip frameworks_base-e8e98704f3ac7b7d4070d4faabc56312efaea9bd.tar.gz frameworks_base-e8e98704f3ac7b7d4070d4faabc56312efaea9bd.tar.bz2 |
Merge "Fix bug #7158772 ProgressBar / SeekBar / RatingBar drawables should be reversed when in RTL mode" into jb-mr1-dev
Diffstat (limited to 'core/java/android/widget/ProgressBar.java')
-rw-r--r-- | core/java/android/widget/ProgressBar.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java index 6afaba3..ea50e2e 100644 --- a/core/java/android/widget/ProgressBar.java +++ b/core/java/android/widget/ProgressBar.java @@ -354,7 +354,7 @@ public class ProgressBar extends View { Shader.TileMode.REPEAT, Shader.TileMode.CLAMP); shapeDrawable.getPaint().setShader(bitmapShader); - return (clip) ? new ClipDrawable(shapeDrawable, Gravity.START, + return (clip) ? new ClipDrawable(shapeDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL) : shapeDrawable; } @@ -1040,6 +1040,11 @@ public class ProgressBar extends View { } } } + if (isLayoutRtl()) { + int tempLeft = left; + left = w - right; + right = w - tempLeft; + } mIndeterminateDrawable.setBounds(left, top, right, bottom); } @@ -1057,7 +1062,12 @@ public class ProgressBar extends View { // Translate canvas so a indeterminate circular progress bar with padding // rotates properly in its animation canvas.save(); - canvas.translate(mPaddingLeft, mPaddingTop); + if(isLayoutRtl()) { + canvas.translate(getWidth() - mPaddingRight, mPaddingTop); + canvas.scale(-1.0f, 1.0f); + } else { + canvas.translate(mPaddingLeft, mPaddingTop); + } long time = getDrawingTime(); if (mHasAnimation) { mAnimation.getTransformation(time, mTransformation); |