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

Commit 52170293 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Not rendering the dark icons with the shelf anymore" into qt-r1-dev

parents 9242dcfb 195dfc5d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -25,14 +25,11 @@
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    androidprv:layout_maxWidth="@dimen/keyguard_security_width"
    androidprv:layout_maxHeight="@dimen/keyguard_security_height"
    android:gravity="center_horizontal|top">
    <LinearLayout
        android:id="@+id/status_view_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/widget_vertical_padding"
        android:orientation="vertical">
        <TextView
            android:id="@+id/logout"
@@ -71,5 +68,11 @@
            android:letterSpacing="0.05"
            android:ellipsize="marquee"
            android:singleLine="true" />
        <com.android.systemui.statusbar.phone.NotificationIconContainer
            android:id="@+id/clock_notification_icon_container"
            android:layout_width="match_parent"
            android:layout_height="@dimen/notification_shelf_height"
            android:layout_marginTop="18dp"
        />
    </LinearLayout>
</com.android.keyguard.KeyguardStatusView>
+2 −2
Original line number Diff line number Diff line
@@ -258,8 +258,8 @@
    <!-- size at which Notification icons will be drawn on Ambient Display -->
    <dimen name="status_bar_icon_drawing_size_dark">@*android:dimen/notification_header_icon_size_ambient</dimen>

    <!-- size of notification icons on AOD -->
    <dimen name="dark_shelf_icon_size">16dp</dimen>
    <!-- size of notification icons when the notifications are hidden -->
    <dimen name="hidden_shelf_icon_size">16dp</dimen>

    <!-- opacity at which Notification icons will be drawn in the status bar -->
    <item type="dimen" name="status_bar_icon_drawing_alpha">90%</item>
+1 −1
Original line number Diff line number Diff line
@@ -515,7 +515,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
        viewState.gone = false;
        viewState.hidden = false;
        viewState.dimmed = false;
        viewState.dark = false;
        viewState.dozing = false;
        viewState.alpha = 1f;
        viewState.notGoneIndex = -1;
        viewState.xTranslation = 0;
+10 −47
Original line number Diff line number Diff line
@@ -63,15 +63,12 @@ public class NotificationShelf extends ActivatableNotificationView implements
            = SystemProperties.getBoolean("debug.icon_scroll_animations", true);
    private static final int TAG_CONTINUOUS_CLIPPING = R.id.continuous_clipping_tag;
    private static final String TAG = "NotificationShelf";
    private static final long SHELF_IN_TRANSLATION_DURATION = 200;

    private NotificationIconContainer mShelfIcons;
    private int[] mTmp = new int[2];
    private boolean mHideBackground;
    private int mIconAppearTopPadding;
    private int mShelfAppearTranslation;
    private float mDarkShelfPadding;
    private float mDarkShelfIconSize;
    private float mHiddenShelfIconSize;
    private int mStatusBarHeight;
    private int mStatusBarPaddingStart;
    private AmbientState mAmbientState;
@@ -140,8 +137,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
        mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height);
        mStatusBarPaddingStart = res.getDimensionPixelOffset(R.dimen.status_bar_padding_start);
        mPaddingBetweenElements = res.getDimensionPixelSize(R.dimen.notification_divider_height);
        mShelfAppearTranslation = res.getDimensionPixelSize(R.dimen.shelf_appear_translation);
        mDarkShelfPadding = res.getDimensionPixelSize(R.dimen.widget_bottom_separator_padding);

        ViewGroup.LayoutParams layoutParams = getLayoutParams();
        layoutParams.height = res.getDimensionPixelOffset(R.dimen.notification_shelf_height);
@@ -152,7 +147,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
        mScrollFastThreshold = res.getDimensionPixelOffset(R.dimen.scroll_fast_threshold);
        mShowNotificationShelf = res.getBoolean(R.bool.config_showNotificationShelf);
        mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size);
        mDarkShelfIconSize = res.getDimensionPixelOffset(R.dimen.dark_shelf_icon_size);
        mHiddenShelfIconSize = res.getDimensionPixelOffset(R.dimen.hidden_shelf_icon_size);
        mGapHeight = res.getDimensionPixelSize(R.dimen.qs_notification_padding);

        if (!mShowNotificationShelf) {
@@ -166,33 +161,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
        initDimens();
    }

    @Override
    public void setDark(boolean dark, boolean fade, long delay) {
        if (mDark == dark) return;
        super.setDark(dark, fade, delay);
        mShelfIcons.setDark(dark, fade, delay);
        updateInteractiveness();
        updateOutline();
    }

    /**
     * Alpha animation with translation played when this view is visible on AOD.
     */
    public void fadeInTranslating() {
        mShelfIcons.setTranslationY(-mShelfAppearTranslation);
        mShelfIcons.setAlpha(0);
        mShelfIcons.animate()
                .setInterpolator(Interpolators.DECELERATE_QUINT)
                .translationY(0)
                .setDuration(SHELF_IN_TRANSLATION_DURATION)
                .start();
        mShelfIcons.animate()
                .alpha(1)
                .setInterpolator(Interpolators.LINEAR)
                .setDuration(SHELF_IN_TRANSLATION_DURATION)
                .start();
    }

    @Override
    protected View getContentView() {
        return mShelfIcons;
@@ -219,11 +187,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
            viewState.copyFrom(lastViewState);
            viewState.height = getIntrinsicHeight();

            float awakenTranslation = Math.max(Math.min(viewEnd, maxShelfEnd) - viewState.height,
            viewState.yTranslation = Math.max(Math.min(viewEnd, maxShelfEnd) - viewState.height,
                    getFullyClosedTranslation());
            float yRatio = mAmbientState.hasPulsingNotifications() ?
                    0 : mAmbientState.getDarkAmount();
            viewState.yTranslation = awakenTranslation + mDarkShelfPadding * yRatio;
            viewState.zTranslation = ambientState.getBaseZHeight();
            // For the small display size, it's not enough to make the icon not covered by
            // the top cutout so the denominator add the height of cutout.
@@ -452,7 +417,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
        }
        StatusBarIconView icon = row.getEntry().expandedIcon;
        float shelfIconPosition = getTranslationY() + icon.getTop() + icon.getTranslationY();
        if (shelfIconPosition < maxTop && !mAmbientState.isFullyDark()) {
        if (shelfIconPosition < maxTop && !mAmbientState.isFullyHidden()) {
            int top = (int) (maxTop - shelfIconPosition);
            Rect clipRect = new Rect(0, top, icon.getWidth(), Math.max(top, icon.getHeight()));
            icon.setClipBounds(clipRect);
@@ -666,8 +631,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
            iconState.translateContent = false;
        }
        float transitionAmount;
        if (mAmbientState.isDarkAtAll() && !row.isInShelf()) {
            transitionAmount = mAmbientState.isFullyDark() ? 1 : 0;
        if (mAmbientState.isHiddenAtAll() && !row.isInShelf()) {
            transitionAmount = mAmbientState.isFullyHidden() ? 1 : 0;
        } else if (isLastChild || !USE_ANIMATIONS_WHEN_OPENING || iconState.useFullTransitionAmount
                || iconState.useLinearTransitionAmount) {
            transitionAmount = iconTransitionAmount;
@@ -717,7 +682,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
        }
        notificationIconPosition += iconTopPadding;
        float shelfIconPosition = getTranslationY() + icon.getTop();
        float iconSize = mDark ? mDarkShelfIconSize : mIconSize;
        float iconSize = mDozing ? mHiddenShelfIconSize : mIconSize;
        shelfIconPosition += (icon.getHeight() - icon.getIconScale() * iconSize) / 2.0f;
        float iconYTranslation = NotificationUtils.interpolate(
                notificationIconPosition - shelfIconPosition,
@@ -794,12 +759,12 @@ public class NotificationShelf extends ActivatableNotificationView implements

    @Override
    protected boolean needsOutline() {
        return !mHideBackground && !mDark && super.needsOutline();
        return !mHideBackground && super.needsOutline();
    }

    @Override
    protected boolean shouldHideBackground() {
        return super.shouldHideBackground() || mHideBackground || mDark;
        return super.shouldHideBackground() || mHideBackground;
    }

    @Override
@@ -910,8 +875,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
    }

    private void updateInteractiveness() {
        mInteractive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf
                && !mDark;
        mInteractive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf;
        setClickable(mInteractive);
        setFocusable(mInteractive);
        setImportantForAccessibility(mInteractive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES
@@ -929,7 +893,6 @@ public class NotificationShelf extends ActivatableNotificationView implements

    public void setAnimationsEnabled(boolean enabled) {
        mAnimationsEnabled = enabled;
        mCollapsedIcons.setAnimationsEnabled(enabled);
        if (!enabled) {
            // we need to wait with enabling the animations until the first frame has passed
            mShelfIcons.setAnimationsEnabled(false);
+24 −21
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
    };

    private boolean mAlwaysScaleIcon;
    private int mStatusBarIconDrawingSizeDark = 1;
    private int mStatusBarIconDrawingSizeIncreased = 1;
    private int mStatusBarIconDrawingSize = 1;
    private int mStatusBarIconSize = 1;
    private StatusBarIcon mIcon;
@@ -139,7 +139,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
    private int mDrawableColor;
    private int mIconColor;
    private int mDecorColor;
    private float mDarkAmount;
    private float mDozeAmount;
    private ValueAnimator mColorAnimator;
    private int mCurrentSetColor = NO_COLOR;
    private int mAnimationStartColor = NO_COLOR;
@@ -158,6 +158,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
    private Runnable mLayoutRunnable;
    private boolean mDismissed;
    private Runnable mOnDismissListener;
    private boolean mIncreasedSize;

    public StatusBarIconView(Context context, String slot, StatusBarNotification sbn) {
        this(context, slot, sbn, false);
@@ -196,12 +197,10 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
    }

    private void updateIconScaleForNotifications() {
        final float imageBounds = NotificationUtils.interpolate(
                mStatusBarIconDrawingSize,
                mStatusBarIconDrawingSizeDark,
                mDarkAmount);
        final float imageBounds = mIncreasedSize ?
                mStatusBarIconDrawingSizeIncreased : mStatusBarIconDrawingSize;
        final int outerBounds = mStatusBarIconSize;
        mIconScale = (float)imageBounds / (float)outerBounds;
        mIconScale = imageBounds / (float)outerBounds;
        updatePivot();
    }

@@ -225,8 +224,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
        }
    }

    public float getIconScaleFullyDark() {
        return (float) mStatusBarIconDrawingSizeDark / mStatusBarIconDrawingSize;
    public float getIconScaleIncreased() {
        return (float) mStatusBarIconDrawingSizeIncreased / mStatusBarIconDrawingSize;
    }

    public float getIconScale() {
@@ -256,7 +255,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
        Resources res = getResources();
        mStaticDotRadius = res.getDimensionPixelSize(R.dimen.overflow_dot_radius);
        mStatusBarIconSize = res.getDimensionPixelSize(R.dimen.status_bar_icon_size);
        mStatusBarIconDrawingSizeDark =
        mStatusBarIconDrawingSizeIncreased =
                res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size_dark);
        mStatusBarIconDrawingSize =
                res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size);
@@ -584,7 +583,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
    }

    private void updateDecorColor() {
        int color = NotificationUtils.interpolateColors(mDecorColor, Color.WHITE, mDarkAmount);
        int color = NotificationUtils.interpolateColors(mDecorColor, Color.WHITE, mDozeAmount);
        if (mDotPaint.getColor() != color) {
            mDotPaint.setColor(color);

@@ -618,13 +617,13 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
                mMatrixColorFilter = new ColorMatrixColorFilter(mMatrix);
            }
            int color = NotificationUtils.interpolateColors(
                    mCurrentSetColor, Color.WHITE, mDarkAmount);
            updateTintMatrix(mMatrix, color, DARK_ALPHA_BOOST * mDarkAmount);
                    mCurrentSetColor, Color.WHITE, mDozeAmount);
            updateTintMatrix(mMatrix, color, DARK_ALPHA_BOOST * mDozeAmount);
            mMatrixColorFilter.setColorMatrixArray(mMatrix);
            setColorFilter(null);  // setColorFilter only invalidates if the instance changed.
            setColorFilter(mMatrixColorFilter);
        } else {
            mDozer.updateGrayscale(this, mDarkAmount);
            mDozer.updateGrayscale(this, mDozeAmount);
        }
    }

@@ -855,19 +854,18 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
        mOnVisibilityChangedListener = listener;
    }

    public void setDark(boolean dark, boolean fade, long delay) {
        mDozer.setIntensityDark(f -> {
            mDarkAmount = f;
            maybeUpdateIconScaleDimens();
    public void setDozing(boolean dozing, boolean fade, long delay) {
        mDozer.setDozing(f -> {
            mDozeAmount = f;
            updateDecorColor();
            updateIconColor();
            updateAllowAnimation();
        }, dark, fade, delay, this);
        }, dozing, fade, delay, this);
    }

    private void updateAllowAnimation() {
        if (mDarkAmount == 0 || mDarkAmount == 1) {
            setAllowAnimation(mDarkAmount == 0);
        if (mDozeAmount == 0 || mDozeAmount == 1) {
            setAllowAnimation(mDozeAmount == 0);
        }
    }

@@ -949,6 +947,11 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
        return mBlocked;
    }

    public void setIncreasedSize(boolean increasedSize) {
        mIncreasedSize = increasedSize;
        maybeUpdateIconScaleDimens();
    }

    public interface OnVisibilityChangedListener {
        void onVisibilityChanged(int newVisibility);
    }
Loading