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

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

Merge "resolved conflicts for merge of 6edef668 to master"

parents 9c1b8af7 b41e0e37
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -332,4 +332,7 @@
    <!-- The width of the region on the left/right edge of the screen for performing the camera/
         phone hints. -->
    <dimen name="edge_tap_area_width">48dp</dimen>

    <!-- the distance the panel moves up when starting the up motion on Keyguard -->
    <dimen name="keyguard_panel_move_up_distance">100dp</dimen>
</resources>
+8 −6
Original line number Diff line number Diff line
@@ -88,13 +88,15 @@ public class KeyguardClockPositionAlgorithm {

    public void run(Result result) {
        int y = getClockY() - mKeyguardStatusHeight/2;
        float clockAdjustment = getClockYExpansionAdjustment();
        float topAdjustment = getTopExpansionAdjustment();
        float topPaddingAdjMultiplier = getTopPaddingAdjMultiplier();
        result.stackScrollerPaddingAdjustment = (int) (clockAdjustment*topPaddingAdjMultiplier);
        result.stackScrollerPaddingAdjustment = (int) (topAdjustment*topPaddingAdjMultiplier);
        int clockNotificationsPadding = getClockNotificationsPadding()
                + result.stackScrollerPaddingAdjustment;
        int padding = y + clockNotificationsPadding;
        y += clockAdjustment;
        if (mNotificationCount == 0) {
            y += topAdjustment;
        }
        result.clockY = y;
        result.stackScrollerPadding = mKeyguardStatusHeight + padding;
        result.clockAlpha = getClockAlpha(result.stackScrollerPadding
@@ -117,8 +119,8 @@ public class KeyguardClockPositionAlgorithm {
        return (int) (getClockYFraction() * mHeight);
    }

    private float getClockYExpansionAdjustment() {
        float rubberbandFactor = getClockYExpansionRubberbandFactor();
    private float getTopExpansionAdjustment() {
        float rubberbandFactor = getTopExpansionRubberbandFactor();
        float value = (rubberbandFactor * (mMaxPanelHeight - mExpandedHeight));
        float t = value / mMaxPanelHeight;
        float slowedDownValue = -sSlowDownInterpolator.getInterpolation(t) * SLOW_DOWN_FACTOR
@@ -130,7 +132,7 @@ public class KeyguardClockPositionAlgorithm {
        }
    }

    private float getClockYExpansionRubberbandFactor() {
    private float getTopExpansionRubberbandFactor() {
        float t = getNotificationAmountT();
        t = Math.min(t, 1.0f);
        t = (float) Math.pow(t, 0.3f);
+5 −0
Original line number Diff line number Diff line
@@ -695,6 +695,11 @@ public class NotificationPanelView extends PanelView implements
        return super.isScrolledToBottom();
    }

    @Override
    protected boolean hasNotifications() {
        return mNotificationStackScroller.getNotGoneChildCount() > 0;
    }

    @Override
    protected int getMaxPanelHeight() {
        // TODO: Figure out transition for collapsing when QS is open, adjust height here.
+68 −2
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import android.view.ViewConfiguration;
import android.view.ViewTreeObserver;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.PathInterpolator;
import android.widget.FrameLayout;

import com.android.systemui.R;
@@ -43,6 +45,8 @@ public abstract class PanelView extends FrameLayout {
    public static final boolean DEBUG = PanelBar.DEBUG;
    public static final String TAG = PanelView.class.getSimpleName();

    private static final long KEYGUARD_MOVE_UP_LENGTH = 300;

    private final void logf(String fmt, Object... args) {
        Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
    }
@@ -62,6 +66,9 @@ public abstract class PanelView extends FrameLayout {
    protected int mTouchSlop;
    protected boolean mHintAnimationRunning;
    private boolean mOverExpandedBeforeFling;
    private boolean mKeyguardMovingUp;
    private int mKeyguardMoveUpDistance;
    private float mKeyguardFingerHeight;

    private ValueAnimator mHeightAnimator;
    private ObjectAnimator mPeekAnimator;
@@ -82,6 +89,8 @@ public abstract class PanelView extends FrameLayout {

    private Interpolator mLinearOutSlowInInterpolator;
    private Interpolator mBounceInterpolator;
    private Interpolator mKeyguardMoveUpInterpolator;
    private final Interpolator mLinearInterpolator = new LinearInterpolator();

    protected void onExpandingFinished() {
        mBar.onExpandingFinished();
@@ -109,6 +118,7 @@ public abstract class PanelView extends FrameLayout {
        mLinearOutSlowInInterpolator =
                AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in);
        mBounceInterpolator = new BounceInterpolator();
        mKeyguardMoveUpInterpolator = new PathInterpolator(0.6f, 0f, 0.4f, 1f);
    }

    protected void loadDimens() {
@@ -120,6 +130,8 @@ public abstract class PanelView extends FrameLayout {
        mTouchSlop = configuration.getScaledTouchSlop();
        mHintDistance = res.getDimension(R.dimen.hint_move_distance);
        mEdgeTapAreaWidth = res.getDimensionPixelSize(R.dimen.edge_tap_area_width);
        mKeyguardMoveUpDistance =
                res.getDimensionPixelSize(R.dimen.keyguard_panel_move_up_distance);
    }

    private void trackMovement(MotionEvent event) {
@@ -217,9 +229,14 @@ public abstract class PanelView extends FrameLayout {
                    mJustPeeked = false;
                }
                if (!mJustPeeked && (!waitForTouchSlop || mTracking)) {
                    if (mStatusBar.getBarState() == StatusBarState.KEYGUARD &&
                            !hasNotifications()) {
                        setExpandedHeightKeyguard(newHeight);
                    } else {
                        setExpandedHeightInternal(newHeight);
                        mBar.panelExpansionChanged(PanelView.this, mExpandedFraction);
                    }
                }

                trackMovement(event);
                break;
@@ -247,10 +264,56 @@ public abstract class PanelView extends FrameLayout {
        return !waitForTouchSlop || mTracking;
    }

    protected abstract boolean hasNotifications();

    private void setExpandedHeightKeyguard(float newHeight) {
        mKeyguardFingerHeight = newHeight;
        if (newHeight < getMaxPanelHeight() && !mKeyguardMovingUp) {
            mKeyguardMovingUp = true;
            ValueAnimator anim = createHeightAnimator(
                    getMaxPanelHeight() - mKeyguardMoveUpDistance);
            anim.setDuration(KEYGUARD_MOVE_UP_LENGTH);
            anim.setInterpolator(mKeyguardMoveUpInterpolator);
            anim.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    mHeightAnimator = null;
                }
            });
            mHeightAnimator = anim;
            anim.start();
            postOnAnimationDelayed(new Runnable() {
                @Override
                public void run() {
                    if (mKeyguardFingerHeight < mExpandedHeight && mHeightAnimator != null
                            && mKeyguardMovingUp) {
                        mHeightAnimator.cancel();
                        float target = getMaxPanelHeight() - 1.75f * mKeyguardMoveUpDistance;
                        float diff = mExpandedHeight - target;
                        ValueAnimator anim = createHeightAnimator(target);
                        float velocity = 2.5f * mKeyguardMoveUpDistance /
                                (KEYGUARD_MOVE_UP_LENGTH / 1000f);
                        anim.setInterpolator(mLinearInterpolator);
                        anim.setDuration(Math.max(0, (long) (diff / velocity * 1000f)));
                        anim.addListener(new AnimatorListenerAdapter() {
                            @Override
                            public void onAnimationEnd(Animator animation) {
                                mHeightAnimator = null;
                            }
                        });
                        mHeightAnimator = anim;
                        anim.start();
                    }
                }
            }, KEYGUARD_MOVE_UP_LENGTH / 2);
        }
    }

    protected abstract boolean hasConflictingGestures();

    protected void onTrackingStopped(boolean expand) {
        mTracking = false;
        mKeyguardMovingUp = false;
        mBar.onTrackingStopped(PanelView.this, expand);
    }

@@ -381,6 +444,9 @@ public abstract class PanelView extends FrameLayout {

    protected void fling(float vel, boolean expand) {
        cancelPeek();
        if (mHeightAnimator != null) {
            mHeightAnimator.cancel();
        }
        float target = expand ? getMaxPanelHeight() : 0.0f;
        if (target == mExpandedHeight || getOverExpansionAmount() > 0f && expand) {
            onExpandingFinished();