Loading core/java/android/widget/ProgressBar.java +24 −1 Original line number Diff line number Diff line Loading @@ -933,9 +933,32 @@ public class ProgressBar extends View { // onDraw will translate the canvas so we draw starting at 0,0 int right = w - mPaddingRight - mPaddingLeft; int bottom = h - mPaddingBottom - mPaddingTop; int top = 0; int left = 0; if (mIndeterminateDrawable != null) { mIndeterminateDrawable.setBounds(0, 0, right, bottom); if (mOnlyIndeterminate) { // Maintain aspect ratio. Certain kinds of animated drawables // get very confused otherwise. final int intrinsicWidth = mIndeterminateDrawable.getIntrinsicWidth(); final int intrinsicHeight = mIndeterminateDrawable.getIntrinsicHeight(); final float intrinsicAspect = (float) intrinsicWidth / intrinsicHeight; final float boundAspect = (float) w / h; if (intrinsicAspect != boundAspect) { if (boundAspect > intrinsicAspect) { // New width is larger. Make it smaller to match height. final int width = (int) (h * intrinsicAspect); left = (w - width) / 2; right = left + width; } else { // New height is larger. Make it smaller to match width. final int height = (int) (w * (1 / intrinsicAspect)); top = (h - height) / 2; bottom = top + height; } } } mIndeterminateDrawable.setBounds(left, top, right, bottom); } if (mProgressDrawable != null) { Loading graphics/java/android/graphics/drawable/RotateDrawable.java +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ public class RotateDrawable extends Drawable implements Drawable.Callback { float px = st.mPivotXRel ? (w * st.mPivotX) : st.mPivotX; float py = st.mPivotYRel ? (h * st.mPivotY) : st.mPivotY; canvas.rotate(st.mCurrentDegrees, px, py); canvas.rotate(st.mCurrentDegrees, px + bounds.left, py + bounds.top); st.mDrawable.draw(canvas); Loading Loading
core/java/android/widget/ProgressBar.java +24 −1 Original line number Diff line number Diff line Loading @@ -933,9 +933,32 @@ public class ProgressBar extends View { // onDraw will translate the canvas so we draw starting at 0,0 int right = w - mPaddingRight - mPaddingLeft; int bottom = h - mPaddingBottom - mPaddingTop; int top = 0; int left = 0; if (mIndeterminateDrawable != null) { mIndeterminateDrawable.setBounds(0, 0, right, bottom); if (mOnlyIndeterminate) { // Maintain aspect ratio. Certain kinds of animated drawables // get very confused otherwise. final int intrinsicWidth = mIndeterminateDrawable.getIntrinsicWidth(); final int intrinsicHeight = mIndeterminateDrawable.getIntrinsicHeight(); final float intrinsicAspect = (float) intrinsicWidth / intrinsicHeight; final float boundAspect = (float) w / h; if (intrinsicAspect != boundAspect) { if (boundAspect > intrinsicAspect) { // New width is larger. Make it smaller to match height. final int width = (int) (h * intrinsicAspect); left = (w - width) / 2; right = left + width; } else { // New height is larger. Make it smaller to match width. final int height = (int) (w * (1 / intrinsicAspect)); top = (h - height) / 2; bottom = top + height; } } } mIndeterminateDrawable.setBounds(left, top, right, bottom); } if (mProgressDrawable != null) { Loading
graphics/java/android/graphics/drawable/RotateDrawable.java +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ public class RotateDrawable extends Drawable implements Drawable.Callback { float px = st.mPivotXRel ? (w * st.mPivotX) : st.mPivotX; float py = st.mPivotYRel ? (h * st.mPivotY) : st.mPivotY; canvas.rotate(st.mCurrentDegrees, px, py); canvas.rotate(st.mCurrentDegrees, px + bounds.left, py + bounds.top); st.mDrawable.draw(canvas); Loading