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

Commit 65b4bb8c authored by Adrian Roos's avatar Adrian Roos Committed by android-build-merger
Browse files

Merge "AOD: Anchor clock at a third of the height" into oc-dev

am: 2af0676b

Change-Id: I4eefd2a95a82c573f54fe3e71919e8553c42d206
parents 147e154a 2af0676b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -280,6 +280,9 @@ public class KeyguardStatusView extends GridLayout {
    }

    public void setDark(boolean dark) {
        if (mDark == dark) {
            return;
        }
        mDark = dark;

        final int N = mClockContainer.getChildCount();
+14 −7
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.view.animation.AccelerateInterpolator;
import android.view.animation.PathInterpolator;

import com.android.systemui.R;
import com.android.systemui.statusbar.notification.NotificationUtils;

/**
 * Utility class to calculate the clock position and top padding of notifications on Keyguard.
@@ -69,7 +70,7 @@ public class KeyguardClockPositionAlgorithm {

    private AccelerateInterpolator mAccelerateInterpolator = new AccelerateInterpolator();
    private int mClockBottom;
    private boolean mDark;
    private float mDarkAmount;

    /**
     * Refreshes the dimension values.
@@ -89,7 +90,7 @@ public class KeyguardClockPositionAlgorithm {

    public void setup(int maxKeyguardNotifications, int maxPanelHeight, float expandedHeight,
            int notificationCount, int height, int keyguardStatusHeight, float emptyDragAmount,
            int clockBottom, boolean dark) {
            int clockBottom, float dark) {
        mMaxKeyguardNotifications = maxKeyguardNotifications;
        mMaxPanelHeight = maxPanelHeight;
        mExpandedHeight = expandedHeight;
@@ -98,7 +99,7 @@ public class KeyguardClockPositionAlgorithm {
        mKeyguardStatusHeight = keyguardStatusHeight;
        mEmptyDragAmount = emptyDragAmount;
        mClockBottom = clockBottom;
        mDark = dark;
        mDarkAmount = dark;
    }

    public float getMinStackScrollerPadding(int height, int keyguardStatusHeight) {
@@ -120,9 +121,11 @@ public class KeyguardClockPositionAlgorithm {
                result.clockY,
                y + getClockNotificationsPadding() + mKeyguardStatusHeight);
        result.clockAlpha = getClockAlpha(result.clockScale);
        if (mDark) {
            result.stackScrollerPadding = mClockBottom + y;
        }

        result.stackScrollerPadding = (int) NotificationUtils.interpolate(
                result.stackScrollerPadding,
                mClockBottom + y,
                mDarkAmount);
    }

    private float getClockScale(int notificationPadding, int clockY, int startPadding) {
@@ -149,7 +152,11 @@ public class KeyguardClockPositionAlgorithm {
    }

    private int getClockY() {
        return (int) (getClockYFraction() * mHeight);
        // Dark: Align the bottom edge of the clock at one third:
        // clockBottomEdge = result - mKeyguardStatusHeight / 2 + mClockBottom
        float clockYDark = (0.33f * mHeight + (float) mKeyguardStatusHeight / 2 - mClockBottom);
        float clockYRegular = getClockYFraction() * mHeight;
        return (int) NotificationUtils.interpolate(clockYRegular, clockYDark, mDarkAmount);
    }

    private float getClockYExpansionAdjustment() {
+38 −5
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.util.MathUtils;
import android.view.MotionEvent;
import android.view.VelocityTracker;
@@ -91,6 +92,19 @@ public class NotificationPanelView extends PanelView implements

    public static final long DOZE_ANIMATION_DURATION = 700;

    private static final FloatProperty<NotificationPanelView> SET_DARK_AMOUNT_PROPERTY =
            new FloatProperty<NotificationPanelView>("mDarkAmount") {
                @Override
                public void setValue(NotificationPanelView object, float value) {
                    object.setDarkAmount(value);
                }

                @Override
                public Float get(NotificationPanelView object) {
                    return object.mDarkAmount;
                }
            };

    private KeyguardAffordanceHelper mAffordanceHelper;
    private KeyguardUserSwitcher mKeyguardUserSwitcher;
    private KeyguardStatusBarView mKeyguardStatusBar;
@@ -211,9 +225,10 @@ public class NotificationPanelView extends PanelView implements
    private boolean mShowIconsWhenExpanded;
    private int mIndicationBottomPadding;
    private boolean mIsFullWidth;
    private boolean mDark;
    private float mDarkAmount;
    private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
    private boolean mNoVisibleNotifications = true;
    private ValueAnimator mDarkAnimator;

    public NotificationPanelView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -397,7 +412,7 @@ public class NotificationPanelView extends PanelView implements
                    mKeyguardStatusView.getHeight(),
                    mEmptyDragAmount,
                    mKeyguardStatusView.getClockBottom(),
                    mDark);
                    mDarkAmount);
            mClockPositionAlgorithm.run(mClockPositionResult);
            if (animate || mClockAnimator != null) {
                startClockAnimation(mClockPositionResult.clockY);
@@ -2473,9 +2488,27 @@ public class NotificationPanelView extends PanelView implements
        }
    }

    public void setDark(boolean dark) {
        mDark = dark;
        mKeyguardStatusView.setDark(dark);
    public void setDark(boolean dark, boolean animate) {
        float darkAmount = dark ? 1 : 0;
        if (mDarkAmount == darkAmount) {
            return;
        }
        if (mDarkAnimator != null && mDarkAnimator.isRunning()) {
            mDarkAnimator.cancel();
        }
        if (animate) {
            mDarkAnimator = ObjectAnimator.ofFloat(this, SET_DARK_AMOUNT_PROPERTY, darkAmount);
            mDarkAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
            mDarkAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
            mDarkAnimator.start();
        } else {
            setDarkAmount(darkAmount);
        }
    }

    private void setDarkAmount(float amount) {
        mDarkAmount = amount;
        mKeyguardStatusView.setDark(amount == 1);
        positionClockAndNotifications();
    }

+1 −1
Original line number Diff line number Diff line
@@ -4360,7 +4360,7 @@ public class StatusBar extends SystemUI implements DemoMode,
        mStackScroller.setDark(mDozing, animate, mWakeUpTouchLocation);
        mScrimController.setDozing(mDozing);
        mKeyguardIndicationController.setDozing(mDozing);
        mNotificationPanel.setDark(mDozing);
        mNotificationPanel.setDark(mDozing, animate);
        updateQsExpansionEnabled();

        // Immediately abort the dozing from the doze scrim controller in case of wake-and-unlock