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

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

Merge "The heads up now correctly dissapears when clicking" into mnc-dev

parents 53c75014 0fccc729
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -49,5 +49,6 @@

    <!-- For notification icons for which targetSdk < L, this caches whether the icon is grayscale -->
    <item type="id" name="icon_is_grayscale" />
    <item type="id" name="is_clicked_heads_up_tag" />
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -1525,6 +1525,7 @@ public abstract class BaseStatusBar extends SystemUI implements
                        //
                        // In most cases, when FLAG_AUTO_CANCEL is set, the notification will
                        // become canceled shortly by NoMan, but we can't assume that.
                        HeadsUpManager.setIsClickedNotification(row, true);
                        mHeadsUpManager.releaseImmediately(notificationKey);
                    }
                    new Thread() {
+7 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.util.MathUtils;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewRootImpl;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;
@@ -203,10 +202,12 @@ public class NotificationPanelView extends PanelView implements
    private int mPositionMinSideMargin;
    private int mLastOrientation = -1;
    private boolean mClosingWithAlphaFadeOut;
    private boolean mHeadsUpAnimatingAway;

    private Runnable mHeadsUpExistenceChangedRunnable = new Runnable() {
        @Override
        public void run() {
            mHeadsUpAnimatingAway = false;
            notifyBarPanelExpansionChanged();
        }
    };
@@ -2292,6 +2293,7 @@ public class NotificationPanelView extends PanelView implements
            mHeadsUpExistenceChangedRunnable.run();
            updateNotificationTranslucency();
        } else {
            mHeadsUpAnimatingAway = true;
            mNotificationStackScroller.runAfterAnimationFinished(
                    mHeadsUpExistenceChangedRunnable);
        }
@@ -2382,4 +2384,8 @@ public class NotificationPanelView extends PanelView implements
    public void clearNotificattonEffects() {
        mStatusBar.clearNotificationEffects();
    }

    protected boolean isPanelVisibleBecauseOfHeadsUp() {
        return mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpAnimatingAway;
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -1009,10 +1009,12 @@ public abstract class PanelView extends FrameLayout {

    protected void notifyBarPanelExpansionChanged() {
        mBar.panelExpansionChanged(this, mExpandedFraction, mExpandedFraction > 0f || mPeekPending
                || mPeekAnimator != null || mInstantExpanding || mHeadsUpManager.hasPinnedHeadsUp()
                || mPeekAnimator != null || mInstantExpanding || isPanelVisibleBecauseOfHeadsUp()
                || mTracking || mHeightAnimator != null);
    }

    protected abstract boolean isPanelVisibleBecauseOfHeadsUp();

    /**
     * Gets called when the user performs a click anywhere in the empty area of the panel.
     *
+10 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
    private static final String TAG = "HeadsUpManager";
    private static final boolean DEBUG = false;
    private static final String SETTING_HEADS_UP_SNOOZE_LENGTH_MS = "heads_up_snooze_length_ms";
    private static final int TAG_CLICKED_NOTIFICATION = R.id.is_clicked_heads_up_tag;

    private final int mHeadsUpNotificationDecay;
    private final int mMinimumDisplayTime;
@@ -526,6 +527,15 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
        });
    }

    public static void setIsClickedNotification(View child, boolean clicked) {
        child.setTag(TAG_CLICKED_NOTIFICATION, clicked ? true : null);
    }

    public static boolean isClickedHeadsUpNotification(View child) {
        Boolean clicked = (Boolean) child.getTag(TAG_CLICKED_NOTIFICATION);
        return clicked != null && clicked;
    }

    /**
     * This represents a notification and how long it is in a heads up mode. It also manages its
     * lifecycle automatically when created.
Loading