summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2013-10-08 18:38:26 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-08 18:38:26 +0000
commitc23ee579ac21f1f67a30d75e8ac7cbd49ba2fe7d (patch)
tree8e1e7efb51bc413aa2d39e865697cf0455ee21a0 /packages
parent4268600f39ff8cf19dcb84c7e13f4c208a8e8127 (diff)
parent5547b55bae92e6674e528d671f7700d7f5a9b3d0 (diff)
downloadframeworks_base-c23ee579ac21f1f67a30d75e8ac7cbd49ba2fe7d.zip
frameworks_base-c23ee579ac21f1f67a30d75e8ac7cbd49ba2fe7d.tar.gz
frameworks_base-c23ee579ac21f1f67a30d75e8ac7cbd49ba2fe7d.tar.bz2
Merge "Disable dragging the challenge area when there are no widgets" into klp-dev
Diffstat (limited to 'packages')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java6
-rw-r--r--packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java17
2 files changed, 20 insertions, 3 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
index f1af3b3b..c4be72f 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
@@ -405,6 +405,12 @@ public class KeyguardHostView extends KeyguardViewBase {
mAppWidgetContainer.setAddWidgetEnabled(false);
}
checkAppWidgetConsistency();
+
+ // Don't let the user drag the challenge down if widgets are disabled.
+ if (mSlidingChallengeLayout != null) {
+ mSlidingChallengeLayout.setEnableChallengeDragging(!widgetsDisabled());
+ }
+
mSwitchPageRunnable.run();
// This needs to be called after the pages are all added.
mViewStateManager.showUsabilityHints();
diff --git a/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java b/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java
index 4f377a3..5e7816c 100644
--- a/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java
+++ b/packages/Keyguard/src/com/android/keyguard/SlidingChallengeLayout.java
@@ -48,7 +48,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
private static final boolean DEBUG = false;
// The drag handle is measured in dp above & below the top edge of the
- // challenge view; these parameters change based on whether the challenge
+ // challenge view; these parameters change based on whether the challenge
// is open or closed.
private static final int DRAG_HANDLE_CLOSED_ABOVE = 8; // dp
private static final int DRAG_HANDLE_CLOSED_BELOW = 0; // dp
@@ -81,6 +81,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
private int mScrollState;
private OnChallengeScrolledListener mScrollListener;
private OnBouncerStateChangedListener mBouncerListener;
+ private boolean mEnableChallengeDragging;
public static final int SCROLL_STATE_IDLE = 0;
public static final int SCROLL_STATE_DRAGGING = 1;
@@ -263,6 +264,10 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}
+ public void setEnableChallengeDragging(boolean enabled) {
+ mEnableChallengeDragging = enabled;
+ }
+
public void setInsets(Rect insets) {
mInsets.set(insets);
}
@@ -573,7 +578,8 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
final float y = ev.getY(i);
if (!mIsBouncing && mActivePointerId == INVALID_POINTER
&& (crossedDragHandle(x, y, mGestureStartY)
- || (isInChallengeView(x, y) &&
+ && shouldEnableChallengeDragging()
+ || (isInChallengeView(x, y) &&
mScrollState == SCROLL_STATE_SETTLING))) {
mActivePointerId = ev.getPointerId(i);
mGestureStartX = x;
@@ -581,7 +587,8 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
mGestureStartChallengeBottom = getChallengeBottom();
mDragging = true;
enableHardwareLayerForChallengeView();
- } else if (mChallengeShowing && isInChallengeView(x, y)) {
+ } else if (mChallengeShowing && isInChallengeView(x, y)
+ && shouldEnableChallengeDragging()) {
mBlockDrag = true;
}
}
@@ -596,6 +603,10 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
return mDragging;
}
+ private boolean shouldEnableChallengeDragging() {
+ return mEnableChallengeDragging || !mChallengeShowing;
+ }
+
private boolean isChallengeInteractionBlocked() {
return !mChallengeInteractiveExternal || !mChallengeInteractiveInternal;
}