Fixing homescreen getting blank when returning from the overlay

Change-Id: Ie11b92cd59c90e71b9b58eeede742ef0c5b28380
This commit is contained in:
Sunny Goyal committed 2016-02-26 08:47:21 -08:00
1 parent 6646016ff5
commit ee68816be8
2 files changed
+28 -9

No files matched your search

+14
View File
@@ -170,6 +170,7 @@ public class Workspace extends PagedView
@Thunk float[] mDragViewVisualCenter = new float[2];
private float[] mTempCellLayoutCenterCoordinates = new float[2];
private int[] mTempVisiblePagesRange = new int[2];
private Matrix mTempMatrix = new Matrix();
private SpringLoadedDragController mSpringLoadedDragController;
private float mSpringLoadedShrinkFactor;
@@ -1297,6 +1298,7 @@ public class Workspace extends PagedView
if (mIsRtl) {
transX = -transX;
}
mOverlayTranslation = transX;
// TODO(adamcohen): figure out a final effect here. We may need to recommend
// different effects based on device performance. On at least one relatively high-end
@@ -1314,6 +1316,18 @@ public class Workspace extends PagedView
}
}
@Override
protected Matrix getPageShiftMatrix() {
if (Float.compare(mOverlayTranslation, 0) != 0) {
// The pages are translated by mOverlayTranslation. incorporate that in the
// visible page calculation by shifting everything back by that same amount.
mTempMatrix.set(getMatrix());
mTempMatrix.postTranslate(-mOverlayTranslation, 0);
return mTempMatrix;
}
return super.getPageShiftMatrix();
}
private void setTranslationAndAlpha(View v, float transX, float alpha) {
if (v != null) {
v.setTranslationX(transX);