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

Commit fcff4c64 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed the appearing of the statusbar icons

The statusbar icons are now correctly appearing
in case there are no notifications instead of just
jumping.

This also fixed the general case, where the icons wouldn't
fade correctly in landscape

Change-Id: I38c6970b7663a8654a27555c2230e68de81a6da8
Test: observe fading of statusbar icons with and without notifications
Bug: 33652489
parent cde90e50
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public class NotificationShelf extends ActivatableNotificationView {
    private int mScrollFastThreshold;
    private int mStatusBarState;
    private float mMaxShelfEnd;
    private int mRelativeOffset;

    public NotificationShelf(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -475,9 +476,21 @@ public class NotificationShelf extends ActivatableNotificationView {
        return super.shouldHideBackground() || mHideBackground;
    }

    private void setOpenedAmount(float openedAmount) {
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        mCollapsedIcons.getLocationOnScreen(mTmp);
        int start = mTmp[0];
        mRelativeOffset = mTmp[0];
        getLocationOnScreen(mTmp);
        mRelativeOffset -= mTmp[0];
    }

    private void setOpenedAmount(float openedAmount) {
        if (!mAmbientState.isPanelFullWidth()) {
            // We don't do a transformation at all, lets just assume we are fully opened
            openedAmount = 1.0f;
        }
        int start = mRelativeOffset;
        if (isLayoutRtl()) {
            start = getWidth() - start - mCollapsedIcons.getWidth();
        }
+19 −5
Original line number Diff line number Diff line
@@ -210,6 +210,7 @@ public class NotificationPanelView extends PanelView implements
    private NotificationGroupManager mGroupManager;
    private boolean mOpening;
    private int mIndicationBottomPadding;
    private boolean mIsFullWidth;

    public NotificationPanelView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -302,6 +303,7 @@ public class NotificationPanelView extends PanelView implements
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        setIsFullWidth(mNotificationStackScroller.getWidth() == getWidth());

        // Update Clock Pivot
        mKeyguardStatusView.setPivotX(getWidth() / 2);
@@ -340,6 +342,11 @@ public class NotificationPanelView extends PanelView implements
        updateMaxHeadsUpTranslation();
    }

    private void setIsFullWidth(boolean isFullWidth) {
        mIsFullWidth = isFullWidth;
        mNotificationStackScroller.setIsFullWidth(isFullWidth);
    }

    private void startQsSizeChangeAnimation(int oldHeight, final int newHeight) {
        if (mQsSizeChangeAnimator != null) {
            oldHeight = (int) mQsSizeChangeAnimator.getAnimatedValue();
@@ -736,7 +743,7 @@ public class NotificationPanelView extends PanelView implements

    @Override
    protected float getOpeningHeight() {
        return mNotificationStackScroller.getMinExpansionHeight();
        return mNotificationStackScroller.getOpeningHeight();
    }

    @Override
@@ -2288,7 +2295,15 @@ public class NotificationPanelView extends PanelView implements
        }
        mNotificationStackScroller.setExpandedHeight(expandedHeight);
        updateKeyguardBottomAreaAlpha();
        setOpening(expandedHeight <= getOpeningHeight());
        setOpening(isFullWidth() && expandedHeight < getOpeningHeight());
    }

    /**
     * @return whether the notifications are displayed full width and don't have any margins on
     *         the side.
     */
    public boolean isFullWidth() {
        return mIsFullWidth;
    }

    private void setOpening(boolean opening) {
@@ -2401,12 +2416,11 @@ public class NotificationPanelView extends PanelView implements
    }

    public boolean shouldHideNotificationIcons() {
        return !mOpening && !isFullyCollapsed();
        return !isFullWidth() || (!mOpening && !isFullyCollapsed());
    }

    public boolean shouldAnimateIconHiding() {
        // TODO: handle this correctly, not completely working yet
        return mNotificationStackScroller.getTranslationX() != 0;
        return !isFullWidth();
    }

    private final FragmentListener mFragmentListener = new FragmentListener() {
+9 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ public class AmbientState {
    private float mExpandingVelocity;
    private boolean mPanelTracking;
    private boolean mExpansionChanging;
    private boolean mPanelFullWidth;

    public AmbientState(Context context) {
        reload(context);
@@ -287,4 +288,12 @@ public class AmbientState {
    public boolean isPanelTracking() {
        return mPanelTracking;
    }

    public boolean isPanelFullWidth() {
        return mPanelFullWidth;
    }

    public void setPanelFullWidth(boolean panelFullWidth) {
        mPanelFullWidth = panelFullWidth;
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -4012,6 +4012,18 @@ public class NotificationStackScrollLayout extends ViewGroup
        mAmbientState.setExpandingVelocity(expandingVelocity);
    }

    public float getOpeningHeight() {
        if (mEmptyShadeView.getVisibility() == GONE) {
            return getMinExpansionHeight();
        } else {
            return getAppearEndPosition();
        }
    }

    public void setIsFullWidth(boolean isFullWidth) {
        mAmbientState.setPanelFullWidth(isFullWidth);
    }

    /**
     * A listener that is notified when some child locations might have changed.
     */