summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/FastBitmapDrawable.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-11-13 15:47:05 -0800
committerWinson Chung <winsonc@google.com>2013-11-14 11:18:18 -0800
commiteeb5bbc9409978cc2ae52d48380399fcde3d9f85 (patch)
tree6a71c11e8ede1172e4013a49a5807897b28de241 /src/com/android/launcher3/FastBitmapDrawable.java
parente248b83797e6b6ce128085560ad0c5b900413bf2 (diff)
downloadandroid_packages_apps_Trebuchet-eeb5bbc9409978cc2ae52d48380399fcde3d9f85.tar.gz
android_packages_apps_Trebuchet-eeb5bbc9409978cc2ae52d48380399fcde3d9f85.tar.bz2
android_packages_apps_Trebuchet-eeb5bbc9409978cc2ae52d48380399fcde3d9f85.zip
Use the icon bounds for all calculations.
- Fixes a drag and drop issue when the dynamic grid scales icons down, due to the drawable bounds not being equal to their bitmap sizes. Change-Id: If7c68b51131de7bac3195a2619e22340f7789432
Diffstat (limited to 'src/com/android/launcher3/FastBitmapDrawable.java')
-rw-r--r--src/com/android/launcher3/FastBitmapDrawable.java28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/com/android/launcher3/FastBitmapDrawable.java b/src/com/android/launcher3/FastBitmapDrawable.java
index bce6707da..83be14369 100644
--- a/src/com/android/launcher3/FastBitmapDrawable.java
+++ b/src/com/android/launcher3/FastBitmapDrawable.java
@@ -27,19 +27,11 @@ import android.graphics.drawable.Drawable;
class FastBitmapDrawable extends Drawable {
private Bitmap mBitmap;
private int mAlpha;
- private int mWidth;
- private int mHeight;
private final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
FastBitmapDrawable(Bitmap b) {
- mAlpha = 255;
+ mAlpha = 255;
mBitmap = b;
- if (b != null) {
- mWidth = mBitmap.getWidth();
- mHeight = mBitmap.getHeight();
- } else {
- mWidth = mHeight = 0;
- }
}
@Override
@@ -76,32 +68,22 @@ class FastBitmapDrawable extends Drawable {
@Override
public int getIntrinsicWidth() {
- return mWidth;
+ return getBounds().width();
}
@Override
public int getIntrinsicHeight() {
- return mHeight;
+ return getBounds().height();
}
@Override
public int getMinimumWidth() {
- return mWidth;
+ return getBounds().width();
}
@Override
public int getMinimumHeight() {
- return mHeight;
- }
-
- public void setBitmap(Bitmap b) {
- mBitmap = b;
- if (b != null) {
- mWidth = mBitmap.getWidth();
- mHeight = mBitmap.getHeight();
- } else {
- mWidth = mHeight = 0;
- }
+ return getBounds().height();
}
public Bitmap getBitmap() {