Skip to content

Commit 4fc3fb4

Browse files
Jim MillerAndroid (Google) Code Review
authored andcommitted
Merge "Always enable hardware layers in widgets in keyguard while dragging." into jb-mr1-dev
2 parents b25629b + eeadda5 commit 4fc3fb4

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetFrame.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,7 @@ void setOverScrollAmount(float r, boolean left) {
117117
mOverScrollAmount = r;
118118
mForegroundGradient = left ? mLeftToRightGradient : mRightToLeftGradient;
119119
mForegroundAlpha = (int) Math.round((0.85f * r * 255));
120-
if (getLayerType() != LAYER_TYPE_HARDWARE) {
121-
setLayerType(LAYER_TYPE_HARDWARE, null);
122-
}
123120
invalidate();
124-
} else {
125-
if (getLayerType() != LAYER_TYPE_NONE) {
126-
setLayerType(LAYER_TYPE_NONE, null);
127-
}
128121
}
129122
}
130123
}

policy/src/com/android/internal/policy/impl/keyguard/KeyguardWidgetPager.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,25 @@ protected void onUnhandledTap(MotionEvent ev) {
7676
}
7777
}
7878

79+
@Override
80+
protected void onPageBeginMoving() {
81+
// Enable hardware layers while pages are moving
82+
// TODO: We should only do this for the two views that are actually moving
83+
int children = getChildCount();
84+
for (int i = 0; i < children; i++) {
85+
getChildAt(i).setLayerType(LAYER_TYPE_HARDWARE, null);
86+
}
87+
}
88+
89+
@Override
90+
protected void onPageEndMoving() {
91+
// Disable hardware layers while pages are moving
92+
int children = getChildCount();
93+
for (int i = 0; i < children; i++) {
94+
getChildAt(i).setLayerType(LAYER_TYPE_NONE, null);
95+
}
96+
}
97+
7998
/*
8099
* This interpolator emulates the rate at which the perceived scale of an object changes
81100
* as its distance from a camera increases. When this interpolator is applied to a scale

0 commit comments

Comments
 (0)