am 288180c2: Merge "Avoid accidentally using software layers" into klp-dev

* commit '288180c24434ba5b0f35e8f22d39b109b46270e2':
  Avoid accidentally using software layers
This commit is contained in:
John Reck
2013-10-01 22:21:30 -07:00
committed by Android Git Automerger
2 changed files with 11 additions and 13 deletions

View File

@@ -254,7 +254,7 @@ public class KeyguardWidgetFrame extends FrameLayout {
*/ */
public void enableHardwareLayersForContent() { public void enableHardwareLayersForContent() {
View widget = getContent(); View widget = getContent();
if (widget != null) { if (widget != null && widget.isHardwareAccelerated()) {
widget.setLayerType(LAYER_TYPE_HARDWARE, null); widget.setLayerType(LAYER_TYPE_HARDWARE, null);
} }
} }
@@ -271,14 +271,6 @@ public class KeyguardWidgetFrame extends FrameLayout {
} }
} }
public void enableHardwareLayers() {
setLayerType(LAYER_TYPE_HARDWARE, null);
}
public void disableHardwareLayers() {
setLayerType(LAYER_TYPE_NONE, null);
}
public View getContent() { public View getContent() {
return getChildAt(0); return getChildAt(0);
} }

View File

@@ -395,7 +395,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
cancelTransitionsInProgress(); cancelTransitionsInProgress();
mChallengeInteractiveInternal = false; mChallengeInteractiveInternal = false;
mChallengeView.setLayerType(LAYER_TYPE_HARDWARE, null); enableHardwareLayerForChallengeView();
final int sy = mChallengeView.getBottom(); final int sy = mChallengeView.getBottom();
final int dy = y - sy; final int dy = y - sy;
if (dy == 0) { if (dy == 0) {
@@ -580,7 +580,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
mGestureStartY = y; mGestureStartY = y;
mGestureStartChallengeBottom = getChallengeBottom(); mGestureStartChallengeBottom = getChallengeBottom();
mDragging = true; mDragging = true;
mChallengeView.setLayerType(LAYER_TYPE_HARDWARE, null); enableHardwareLayerForChallengeView();
} else if (mChallengeShowing && isInChallengeView(x, y)) { } else if (mChallengeShowing && isInChallengeView(x, y)) {
mBlockDrag = true; mBlockDrag = true;
} }
@@ -657,7 +657,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
mActivePointerId = ev.getPointerId(i); mActivePointerId = ev.getPointerId(i);
mGestureStartChallengeBottom = getChallengeBottom(); mGestureStartChallengeBottom = getChallengeBottom();
mDragging = true; mDragging = true;
mChallengeView.setLayerType(LAYER_TYPE_HARDWARE, null); enableHardwareLayerForChallengeView();
break; break;
} }
} }
@@ -1065,7 +1065,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
private void onFadeStart(boolean show) { private void onFadeStart(boolean show) {
mChallengeInteractiveInternal = false; mChallengeInteractiveInternal = false;
mChallengeView.setLayerType(LAYER_TYPE_HARDWARE, null); enableHardwareLayerForChallengeView();
if (show) { if (show) {
moveChallengeTo(getMinChallengeBottom()); moveChallengeTo(getMinChallengeBottom());
@@ -1074,6 +1074,12 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
setScrollState(SCROLL_STATE_FADING); setScrollState(SCROLL_STATE_FADING);
} }
private void enableHardwareLayerForChallengeView() {
if (mChallengeView.isHardwareAccelerated()) {
mChallengeView.setLayerType(LAYER_TYPE_HARDWARE, null);
}
}
private void onFadeEnd(boolean show) { private void onFadeEnd(boolean show) {
mChallengeInteractiveInternal = true; mChallengeInteractiveInternal = true;
setChallengeShowing(show); setChallengeShowing(show);