mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
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
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user