Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 359f2484 authored by Jim Miller's avatar Jim Miller Committed by Android Git Automerger
Browse files

am 674d7222: am d00284c3: am c23ee579: Merge "Disable dragging the challenge...

am 674d7222: am d00284c3: am c23ee579: Merge "Disable dragging the challenge area when there are no widgets" into klp-dev

* commit '674d7222':
  Disable dragging the challenge area when there are no widgets
parents 09a41c50 674d7222
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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();
+14 −3
Original line number Diff line number Diff line
@@ -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,6 +578,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
                    final float y = ev.getY(i);
                    if (!mIsBouncing && mActivePointerId == INVALID_POINTER
                                && (crossedDragHandle(x, y, mGestureStartY)
                                        && shouldEnableChallengeDragging()
                                        || (isInChallengeView(x, y) &&
                                        mScrollState == SCROLL_STATE_SETTLING))) {
                        mActivePointerId = ev.getPointerId(i);
@@ -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;
    }