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

Commit 37d5c239 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Show bouncer immediately when MOTION_UP is received" into lmp-preview-dev

parents 5859fc10 2fbad7b6
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@ public class KeyguardBouncer {

    public void show() {
        ensureView();
        if (mRoot.getVisibility() == View.VISIBLE) {
            return;
        }

        // Try to dismiss the Keyguard. If no security pattern is set, this will dismiss the whole
        // Keyguard. If we need to authenticate, show the bouncer.
@@ -109,6 +112,10 @@ public class KeyguardBouncer {
        return mRoot != null && mRoot.getVisibility() == View.VISIBLE;
    }

    public void prepare() {
        ensureView();
    }

    private void ensureView() {
        if (mRoot == null) {
            inflateView();
+8 −1
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@
package com.android.systemui.statusbar.phone;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

/**
@@ -50,8 +52,13 @@ public class KeyguardIndicationTextView extends TextView {
    public void switchIndication(CharSequence text) {

        // TODO: Animation, make sure that we will show one indication long enough.
        if (TextUtils.isEmpty(text)) {
            setVisibility(View.INVISIBLE);
        } else {
            setVisibility(View.VISIBLE);
            setText(text);
        }
    }

    /**
     * See {@link #switchIndication}.
+2 −2
Original line number Diff line number Diff line
@@ -664,8 +664,8 @@ public class NotificationPanelView extends PanelView implements
    }

    @Override
    protected void onTrackingStopped() {
        super.onTrackingStopped();
    protected void onTrackingStopped(boolean expand) {
        super.onTrackingStopped(expand);
        mOverExpansion = 0.0f;
        mNotificationStackScroller.setOverScrolledPixels(0.0f, true /* onTop */,
                true /* animate */);
+5 −1
Original line number Diff line number Diff line
@@ -222,7 +222,11 @@ public class PanelBar extends FrameLayout {
        }
    }

    public void onTrackingStopped(PanelView panel) {
    public void onTrackingStopped(PanelView panel, boolean expand) {
        mTracking = false;
    }

    public void onExpandingFinished() {

    }
}
+14 −5
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ public class PanelView extends FrameLayout {
    private float mInitialTouchX;

    protected void onExpandingFinished() {
        mBar.onExpandingFinished();
    }

    protected void onExpandingStarted() {
@@ -184,9 +185,9 @@ public class PanelView extends FrameLayout {
            case MotionEvent.ACTION_CANCEL:
                mTracking = false;
                mTrackingPointer = -1;
                onTrackingStopped();
                trackMovement(event);
                flingWithCurrentVelocity();
                boolean expand = flingWithCurrentVelocity();
                onTrackingStopped(expand);
                if (mVelocityTracker != null) {
                    mVelocityTracker.recycle();
                    mVelocityTracker = null;
@@ -196,8 +197,8 @@ public class PanelView extends FrameLayout {
        return true;
    }

    protected void onTrackingStopped() {
        mBar.onTrackingStopped(PanelView.this);
    protected void onTrackingStopped(boolean expand) {
        mBar.onTrackingStopped(PanelView.this, expand);
    }

    protected void onTrackingStarted() {
@@ -303,7 +304,10 @@ public class PanelView extends FrameLayout {
        mMaxPanelHeight = -1;
    }

    private void flingWithCurrentVelocity() {
    /**
     * @return whether the panel will be expanded after the animation
     */
    private boolean flingWithCurrentVelocity() {
        float vel = getCurrentVelocity();
        boolean expand;
        if (Math.abs(vel) < mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
@@ -312,11 +316,16 @@ public class PanelView extends FrameLayout {
            expand = vel > 0;
        }
        fling(vel, expand);
        return expand;
    }

    protected void fling(float vel, boolean expand) {
        cancelPeek();
        float target = expand ? getMaxPanelHeight() : 0.0f;
        if (target == mExpandedHeight) {
            onExpandingFinished();
            return;
        }
        ValueAnimator animator = ValueAnimator.ofFloat(mExpandedHeight, target);
        if (expand) {
            mFlingAnimationUtils.apply(animator, mExpandedHeight, target, vel, getHeight());
Loading