summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRohit Yengisetty <rohit@cyngn.com>2016-04-11 11:32:08 -0700
committerRohit Yengisetty <rohit@cyngn.com>2016-04-11 11:32:08 -0700
commit9590c56a1ff722255bfb1d701b3eb38e52b8a70c (patch)
tree442777936e63215ec9e8ec7df0d69f60edf9c057 /src
parent0a27115a4055e9ff2a577144fc9bea97f095fb78 (diff)
downloadandroid_packages_apps_ContactsCommon-9590c56a1ff722255bfb1d701b3eb38e52b8a70c.tar.gz
android_packages_apps_ContactsCommon-9590c56a1ff722255bfb1d701b3eb38e52b8a70c.tar.bz2
android_packages_apps_ContactsCommon-9590c56a1ff722255bfb1d701b3eb38e52b8a70c.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. Change-Id: I160a5a4297fb7dc8b8abf7f813ae9646ee2d57fc
Diffstat (limited to 'src')
-rw-r--r--src/com/android/contacts/common/widget/CheckableFlipDrawable.java24
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();
}