Preventing drawing pages in Workspace if possible
Bug: 6427601
Change-Id: I259554557a5856aa17a532c656032c4d6d5826bd
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index a3080a8..ac71b1c 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -747,6 +747,10 @@
}
}
+ protected boolean shouldDrawChild(View child) {
+ return child.getAlpha() > 0;
+ }
+
@Override
protected void dispatchDraw(Canvas canvas) {
int halfScreenSize = getMeasuredWidth() / 2;
@@ -783,7 +787,7 @@
// View.INVISIBLE, preventing re-drawing of their hardware layer
for (int i = getChildCount() - 1; i >= 0; i--) {
final View v = getPageAt(i);
- if (leftScreen <= i && i <= rightScreen && v.getAlpha() > 0) {
+ if (leftScreen <= i && i <= rightScreen && shouldDrawChild(v)) {
v.setVisibility(VISIBLE);
drawChild(canvas, v, drawingTime);
} else {
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 3910c45..b0dda3b 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -450,6 +450,13 @@
public void onChildViewRemoved(View parent, View child) {
}
+ protected boolean shouldDrawChild(View child) {
+ final CellLayout cl = (CellLayout) child;
+ return super.shouldDrawChild(child) &&
+ (cl.getShortcutsAndWidgets().getAlpha() > 0 ||
+ cl.getBackgroundAlpha() > 0);
+ }
+
/**
* @return The open folder on the current screen, or null if there is none
*/