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

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

Merge changes If0edccf8,I086b7bae,I043011c6,I4b05f340,I309097ef, ...

* changes:
  Disabling animations now when the screen is off
  Fixed a quick flash of the icon when adding a notification
  Fixed a bug where the notification icons wouldn't match
  Fixed weirdness about last icon in shelf
  Fixed a regression where custom notification where unreadable
  Fixed a wrong translation calculation on first pull down
parents f7792105 09bd29da
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@
    <include layout="@layout/status_bar_expanded"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />
        android:visibility="invisible" />

    <com.android.systemui.statusbar.ScrimView android:id="@+id/scrim_in_front"
        android:layout_width="match_parent"
+16 −3
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ public class NotificationShelf extends ActivatableNotificationView {
    private float mMaxShelfEnd;
    private int mRelativeOffset;
    private boolean mInteractive;
    private boolean mAnimationsEnabled = true;

    public NotificationShelf(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -388,12 +389,13 @@ public class NotificationShelf extends ActivatableNotificationView {

        View rowIcon = row.getNotificationIcon();
        float notificationIconPosition = row.getTranslationY() + row.getContentTranslation();
        if (usingLinearInterpolation) {
        boolean stayingInShelf = row.isInShelf() && !row.isTransformingIntoShelf();
        if (usingLinearInterpolation && !stayingInShelf) {
            // If we interpolate from the notification position, this might lead to a slightly
            // odd interpolation, since the notification position changes as well. Let's interpolate
            // from a fixed distance. We can only do this if we don't animate and the icon is
            // always in the interpolated positon.
            notificationIconPosition = mMaxShelfEnd - getIntrinsicHeight() - iconTransformDistance;
            notificationIconPosition = getTranslationY() - iconTransformDistance;
        }
        float notificationIconSize = 0.0f;
        int iconTopPadding;
@@ -426,7 +428,7 @@ public class NotificationShelf extends ActivatableNotificationView {
            iconState.hidden = transitionAmount == 0.0f;
            iconState.alpha = alpha;
            iconState.yTranslation = iconYTranslation;
            if (row.isInShelf() && !row.isTransformingIntoShelf()) {
            if (stayingInShelf) {
                iconState.iconAppearAmount = 1.0f;
                iconState.alpha = 1.0f;
                iconState.scaleX = 1.0f;
@@ -573,6 +575,15 @@ public class NotificationShelf extends ActivatableNotificationView {
        mMaxShelfEnd = maxShelfEnd;
    }

    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);
        }
    }

    private class ShelfState extends ExpandableViewState {
        private float openedAmount;
        private boolean hasItemsInStableShelf;
@@ -585,6 +596,7 @@ public class NotificationShelf extends ActivatableNotificationView {
            setOpenedAmount(openedAmount);
            updateAppearance();
            setHasItemsInStableShelf(hasItemsInStableShelf);
            mShelfIcons.setAnimationsEnabled(mAnimationsEnabled);
        }

        @Override
@@ -594,6 +606,7 @@ public class NotificationShelf extends ActivatableNotificationView {
            setOpenedAmount(openedAmount);
            updateAppearance();
            setHasItemsInStableShelf(hasItemsInStableShelf);
            mShelfIcons.setAnimationsEnabled(mAnimationsEnabled);
        }
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -104,6 +104,11 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
        mView.setAlpha(visible ? 1.0f : 0.0f);
    }

    @Override
    protected boolean shouldClearBackgroundOnReapply() {
        return false;
    }

    @Override
    public int getCustomBackgroundColor() {
        int customBackgroundColor = super.getCustomBackgroundColor();
+7 −1
Original line number Diff line number Diff line
@@ -93,7 +93,9 @@ public abstract class NotificationViewWrapper implements TransformableView {
    public void notifyContentUpdated(StatusBarNotification notification, boolean isLowPriority) {
        mDarkInitialized = false;
        Drawable background = mView.getBackground();
        if (shouldClearBackgroundOnReapply()) {
            mBackgroundColor = 0;
        }
        if (background instanceof ColorDrawable) {
            mBackgroundColor = ((ColorDrawable) background).getColor();
            mView.setBackground(null);
@@ -101,6 +103,10 @@ public abstract class NotificationViewWrapper implements TransformableView {
        mShouldInvertDark = mBackgroundColor == 0 || isColorLight(mBackgroundColor);
    }

    protected boolean shouldClearBackgroundOnReapply() {
        return true;
    }

    private boolean isColorLight(int backgroundColor) {
        return Color.alpha(backgroundColor) == 0
                || ColorUtils.calculateLuminance(backgroundColor) > 0.5;
+66 −44
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
    private float mOpenedAmount = 0.0f;
    private float mVisualOverflowAdaption;
    private boolean mDisallowNextAnimation;
    private boolean mAnimationsEnabled = true;

    public NotificationIconContainer(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -255,7 +256,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
            iconState.visibleState = StatusBarIconView.STATE_ICON;
            if (firstOverflowIndex == -1 && (isAmbient
                    || (translationX >= (noOverflowAfter ? layoutEnd - mIconSize : overflowStart)))) {
                firstOverflowIndex = noOverflowAfter ? i - 1 : i;
                firstOverflowIndex = noOverflowAfter && !isAmbient ? i - 1 : i;
                int totalDotLength = mStaticDotRadius * 6 + 2 * mDotPadding;
                visualOverflowStart = overflowStart + mIconSize * (1 + OVERFLOW_EARLY_AMOUNT)
                        - totalDotLength / 2
@@ -422,6 +423,20 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
        return mIconSize;
    }

    public void setAnimationsEnabled(boolean enabled) {
        if (!enabled && mAnimationsEnabled) {
            for (int i = 0; i < getChildCount(); i++) {
                View child = getChildAt(i);
                ViewState childState = mIconStates.get(child);
                if (childState != null) {
                    childState.cancelAnimations(child);
                    childState.applyToView(child);
                }
            }
        }
        mAnimationsEnabled = enabled;
    }

    public class IconState extends ViewState {
        public float iconAppearAmount = 1.0f;
        public float clampedAppearAmount = 1.0f;
@@ -438,12 +453,17 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
                StatusBarIconView icon = (StatusBarIconView) view;
                boolean animate = false;
                AnimationProperties animationProperties = null;
                boolean animationsAllowed = mAnimationsEnabled && !mDisallowNextAnimation;
                if (animationsAllowed) {
                    if (justAdded) {
                        super.applyToView(icon);
                        if (iconAppearAmount != 0.0f) {
                            icon.setAlpha(0.0f);
                    icon.setVisibleState(StatusBarIconView.STATE_HIDDEN, false /* animate */);
                            icon.setVisibleState(StatusBarIconView.STATE_HIDDEN,
                                    false /* animate */);
                            animationProperties = ADD_ICON_PROPERTIES;
                            animate = true;
                        }
                    } else if (visibleState != icon.getVisibleState()) {
                        animationProperties = DOT_ANIMATION_PROPERTIES;
                        animate = true;
@@ -458,7 +478,8 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
                    if (needsCannedAnimation) {
                        AnimationFilter animationFilter = mTempProperties.getAnimationFilter();
                        animationFilter.reset();
                    animationFilter.combineFilter(ICON_ANIMATION_PROPERTIES.getAnimationFilter());
                        animationFilter.combineFilter(
                                ICON_ANIMATION_PROPERTIES.getAnimationFilter());
                        mTempProperties.resetCustomInterpolators();
                        mTempProperties.combineCustomInterpolators(ICON_ANIMATION_PROPERTIES);
                        if (animationProperties != null) {
@@ -482,8 +503,9 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
                        animationProperties.setDuration(CANNED_ANIMATION_DURATION);
                        animate = true;
                    }
                icon.setVisibleState(visibleState);
                if (animate && !mDisallowNextAnimation) {
                }
                icon.setVisibleState(visibleState, animationsAllowed);
                if (animate) {
                    animateTo(icon, animationProperties);
                } else {
                    super.applyToView(view);
Loading