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

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

Improved the behavior with the empty shade view

The empty shade view is now properly appearing

Test: expand panel without notifications, observe smooth transitions
Bug: 33652489
Change-Id: Idedb79121434b974ff221eefd4417c40b100a317
parent 740c1114
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ import com.android.systemui.statusbar.stack.StackScrollState;

public class EmptyShadeView extends StackScrollerDecorView {

    private TextView mEmptyText;

    public EmptyShadeView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
@@ -35,7 +37,7 @@ public class EmptyShadeView extends StackScrollerDecorView {
    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        ((TextView) findViewById(R.id.no_notifications)).setText(R.string.empty_shade_text);
        mEmptyText.setText(R.string.empty_shade_text);
    }

    @Override
@@ -43,18 +45,24 @@ public class EmptyShadeView extends StackScrollerDecorView {
        return findViewById(R.id.no_notifications);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mEmptyText = (TextView) findContentView();
    }

    @Override
    public ExpandableViewState createNewViewState(StackScrollState stackScrollState) {
        return new EmptyShadeViewState();
    }

    public static class EmptyShadeViewState extends ExpandableViewState {
    public class EmptyShadeViewState extends ExpandableViewState {
        @Override
        public void applyToView(View view) {
            super.applyToView(view);
            if (view instanceof EmptyShadeView) {
                EmptyShadeView emptyShadeView = (EmptyShadeView) view;
                boolean visible = this.clipTopAmount <= 0;
                boolean visible = this.clipTopAmount <= mEmptyText.getPaddingTop() * 0.6f;
                emptyShadeView.performVisibilityAnimation(
                        visible && !emptyShadeView.willBeGone());
            }
+12 −8
Original line number Diff line number Diff line
@@ -768,6 +768,7 @@ public class NotificationStackScrollLayout extends ViewGroup
     */
    private float getAppearEndPosition() {
        int appearPosition;
        if (mEmptyShadeView.getVisibility() == GONE) {
            int minNotificationsForShelf = 1;
            if (mTrackingHeadsUp || mHeadsUpManager.hasPinnedHeadsUp()) {
                appearPosition = mHeadsUpManager.getTopHeadsUpPinnedHeight();
@@ -778,6 +779,9 @@ public class NotificationStackScrollLayout extends ViewGroup
            if (getNotGoneChildCount() >= minNotificationsForShelf) {
                appearPosition += mShelf.getIntrinsicHeight();
            }
        } else {
            appearPosition = mEmptyShadeView.getHeight();
        }
        return appearPosition + (onKeyguard() ? mTopPadding : mIntrinsicPadding);
    }

+6 −0
Original line number Diff line number Diff line
@@ -23,9 +23,11 @@ import android.view.ViewGroup;

import com.android.systemui.R;
import com.android.systemui.statusbar.DismissView;
import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.ExpandableView;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StackScrollerDecorView;
import com.android.systemui.statusbar.notification.NotificationUtils;

import java.util.ArrayList;
@@ -324,11 +326,15 @@ public class StackScrollAlgorithm {
        int childHeight = getMaxAllowedChildHeight(child);
        childViewState.yTranslation = currentYPosition;
        boolean isDismissView = child instanceof DismissView;
        boolean isEmptyShadeView = child instanceof EmptyShadeView;

        childViewState.location = ExpandableViewState.LOCATION_MAIN_AREA;
        if (isDismissView) {
            childViewState.yTranslation = Math.min(childViewState.yTranslation,
                    ambientState.getInnerHeight() - childHeight);
        } else if (isEmptyShadeView) {
            childViewState.yTranslation = ambientState.getInnerHeight() - childHeight
                    + ambientState.getStackTranslation() * 0.25f;
        } else {
            clampPositionToShelf(childViewState, ambientState);
        }