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

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

Merge "Improved the behavior with the empty shade view"

parents fe0f4357 cde90e50
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);
        }