diff options
author | Rohit Yengisetty <rohit@cyngn.com> | 2016-04-11 11:32:08 -0700 |
---|---|---|
committer | Rohit Yengisetty <rohit@cyngn.com> | 2016-04-11 13:29:06 -0700 |
commit | ceb8f6f7f6624b0dfd404d78fe9b74a83c5d13f4 (patch) | |
tree | 442777936e63215ec9e8ec7df0d69f60edf9c057 | |
parent | 0a27115a4055e9ff2a577144fc9bea97f095fb78 (diff) | |
download | android_packages_apps_ContactsCommon-ceb8f6f7f6624b0dfd404d78fe9b74a83c5d13f4.tar.gz android_packages_apps_ContactsCommon-ceb8f6f7f6624b0dfd404d78fe9b74a83c5d13f4.tar.bz2 android_packages_apps_ContactsCommon-ceb8f6f7f6624b0dfd404d78fe9b74a83c5d13f4.zip |
Remove scaling option for the Front drawable in CheckableFlipDrawable
The default option was inadventently set to not scale to the
Drawable's bounds. Removing this option altogether as the original
feature that needed this is no longer valid.
Issue-Id: CYNGNOS-2405
Change-Id: I160a5a4297fb7dc8b8abf7f813ae9646ee2d57fc
(cherry picked from commit 9590c56a1ff722255bfb1d701b3eb38e52b8a70c)
-rw-r--r-- | src/com/android/contacts/common/widget/CheckableFlipDrawable.java | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/com/android/contacts/common/widget/CheckableFlipDrawable.java b/src/com/android/contacts/common/widget/CheckableFlipDrawable.java index c64ebba8..ed088963 100644 --- a/src/com/android/contacts/common/widget/CheckableFlipDrawable.java +++ b/src/com/android/contacts/common/widget/CheckableFlipDrawable.java @@ -70,10 +70,6 @@ public class CheckableFlipDrawable extends FlipDrawable implements invalidateSelf(); } - public void scaleFrontDrawableToBounds(boolean fitBounds) { - mFrontDrawable.scaleDrawableToBounds(fitBounds); - } - public void setCheckMarkBackgroundColor(int color) { mCheckmarkDrawable.setBackgroundColor(color); invalidateSelf(); @@ -129,8 +125,6 @@ public class CheckableFlipDrawable extends FlipDrawable implements private static class FrontDrawable extends Drawable implements Drawable.Callback { private Drawable mDrawable; - private boolean mScaleDrawableToBounds = false; // only applies to drawables with intrinsic - // height and width public FrontDrawable(Drawable d) { mDrawable = d; @@ -149,10 +143,6 @@ public class CheckableFlipDrawable extends FlipDrawable implements invalidateSelf(); } - public void scaleDrawableToBounds(boolean fitBounds) { - mScaleDrawableToBounds = fitBounds; - } - @Override public void setTintMode(PorterDuff.Mode tintMode) { mDrawable.setTintMode(tintMode); @@ -197,16 +187,12 @@ public class CheckableFlipDrawable extends FlipDrawable implements if (w <= 0 || h <= 0) { mDrawable.draw(canvas); } else { + final float widthScale = (float) bounds.width() / (float) w; + final float heightScale = (float) bounds.height() / (float) h; + final float scale = Math.max(widthScale, heightScale); canvas.save(); - if (mScaleDrawableToBounds) { - final float widthScale = (float) bounds.width() / (float) w; - final float heightScale = (float) bounds.height() / (float) h; - final float scale = Math.max(widthScale, heightScale); - canvas.scale(scale, scale); - canvas.translate(bounds.left, bounds.top); - } else { - canvas.translate(bounds.centerX() - (w/2f), bounds.centerY() - (h/2f)); - } + canvas.scale(scale, scale); + canvas.translate(bounds.left, bounds.top); mDrawable.draw(canvas); canvas.restore(); } |