From 5b50a25e6d12bdc641a3b48ba9e7c02d63bf00cd Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Mon, 17 Sep 2012 13:35:48 -0700 Subject: [PATCH] Enabling hardware layers while overscrolling widget pager Change-Id: I94bef1aa614f91b115105adbb409def8027f3651 --- core/res/res/layout/keyguard_transport_control_view.xml | 1 - .../policy/impl/keyguard/KeyguardSubdivisionLayout.java | 4 +++- .../internal/policy/impl/keyguard/KeyguardWidgetFrame.java | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/res/res/layout/keyguard_transport_control_view.xml b/core/res/res/layout/keyguard_transport_control_view.xml index 8e7616439133e..c40aa66da93c9 100644 --- a/core/res/res/layout/keyguard_transport_control_view.xml +++ b/core/res/res/layout/keyguard_transport_control_view.xml @@ -20,7 +20,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" - android:layerType="hardware" android:id="@+id/keyguard_transport_control"> diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSubdivisionLayout.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSubdivisionLayout.java index b7d94a9146dca..1cd796c8a9942 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSubdivisionLayout.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSubdivisionLayout.java @@ -97,12 +97,14 @@ public class KeyguardSubdivisionLayout extends ViewGroup { leafs.clear(); getLeafs(leafs, 1); - // We find the first leaf who's depth is not + // If the tree is complete, then we start a new level at the rightmost side. double r = log2(leafs.size()); if (Math.ceil(r) == Math.floor(r)) { return leafs.get(leafs.size() - 1); } + // Tree is not complete, find the first leaf who's depth is less than the depth of + // the tree. int treeDepth = depth(); for (int i = leafs.size() - 1; i >= 0; i--) { BiTree n = leafs.get(i); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java index f9577530fc3d0..70a6ffa35865d 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java @@ -91,7 +91,14 @@ public class KeyguardWidgetFrame extends FrameLayout { mForegroundAlpha = (int) Math.round((r * 255)); mForegroundDrawable.setAlpha(mForegroundAlpha); + if (getLayerType() != LAYER_TYPE_HARDWARE) { + setLayerType(LAYER_TYPE_HARDWARE, null); + } invalidate(); + } else { + if (getLayerType() != LAYER_TYPE_NONE) { + setLayerType(LAYER_TYPE_NONE, null); + } } } }