Fix bugs related to swipe up to home animation.

- Added ConstantState support for FolderAdaptiveIcon and
  ShiftedBitmapDrawable.
- Quick fix for NPE in Workspace#mapOverCellLayout while I investigate
  further.

Bug: 128460496
Change-Id: I5ec02e25dcf9f17aeb37928e675a033bdc8819ae
This commit is contained in:
Jon Miranda
2019-03-12 17:19:30 -07:00
committed by Jonathan Miranda
parent 29cde586f9
commit 0c3692d5ef
3 changed files with 70 additions and 3 deletions

View File

@@ -32,10 +32,14 @@ public class ShiftedBitmapDrawable extends Drawable {
private float mShiftX;
private float mShiftY;
private final ConstantState mConstantState;
public ShiftedBitmapDrawable(Bitmap bitmap, float shiftX, float shiftY) {
mBitmap = bitmap;
mShiftX = shiftX;
mShiftY = shiftY;
mConstantState = new MyConstantState(mBitmap, mShiftX, mShiftY);
}
public float getShiftX() {
@@ -71,4 +75,31 @@ public class ShiftedBitmapDrawable extends Drawable {
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
@Override
public ConstantState getConstantState() {
return mConstantState;
}
private static class MyConstantState extends ConstantState {
private final Bitmap mBitmap;
private float mShiftX;
private float mShiftY;
MyConstantState(Bitmap bitmap, float shiftX, float shiftY) {
mBitmap = bitmap;
mShiftX = shiftX;
mShiftY = shiftY;
}
@Override
public Drawable newDrawable() {
return new ShiftedBitmapDrawable(mBitmap, mShiftX, mShiftY);
}
@Override
public int getChangingConfigurations() {
return 0;
}
}
}