Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +26 −0 Original line number Original line Diff line number Diff line Loading @@ -64,6 +64,8 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.RoundingMode; import java.math.RoundingMode; import java.util.Collections; import java.util.List; /** /** * Renders bubbles in a stack and handles animating expanded and collapsed states. * Renders bubbles in a stack and handles animating expanded and collapsed states. Loading Loading @@ -164,6 +166,8 @@ public class BubbleStackView extends FrameLayout { int[] mTempLoc = new int[2]; int[] mTempLoc = new int[2]; RectF mTempRect = new RectF(); RectF mTempRect = new RectF(); private final List<Rect> mSystemGestureExclusionRects = Collections.singletonList(new Rect()); private ViewTreeObserver.OnPreDrawListener mViewUpdater = private ViewTreeObserver.OnPreDrawListener mViewUpdater = new ViewTreeObserver.OnPreDrawListener() { new ViewTreeObserver.OnPreDrawListener() { @Override @Override Loading @@ -175,6 +179,9 @@ public class BubbleStackView extends FrameLayout { } } }; }; private ViewTreeObserver.OnDrawListener mSystemGestureExcludeUpdater = this::updateSystemGestureExcludeRects; private ViewClippingUtil.ClippingParameters mClippingParameters = private ViewClippingUtil.ClippingParameters mClippingParameters = new ViewClippingUtil.ClippingParameters() { new ViewClippingUtil.ClippingParameters() { Loading Loading @@ -296,6 +303,9 @@ public class BubbleStackView extends FrameLayout { () -> mExpandedBubble.expandedView.updateInsets(insets)); () -> mExpandedBubble.expandedView.updateInsets(insets)); return view.onApplyWindowInsets(insets); return view.onApplyWindowInsets(insets); }); }); // This must be a separate OnDrawListener since it should be called for every draw. getViewTreeObserver().addOnDrawListener(mSystemGestureExcludeUpdater); } } /** /** Loading Loading @@ -362,6 +372,22 @@ public class BubbleStackView extends FrameLayout { return false; return false; } } private void updateSystemGestureExcludeRects() { // Exclude the region occupied by the first BubbleView in the stack Rect excludeZone = mSystemGestureExclusionRects.get(0); if (mBubbleContainer.getChildCount() > 0) { View firstBubble = mBubbleContainer.getChildAt(0); excludeZone.set(firstBubble.getLeft(), firstBubble.getTop(), firstBubble.getRight(), firstBubble.getBottom()); excludeZone.offset((int) (firstBubble.getTranslationX() + 0.5f), (int) (firstBubble.getTranslationY() + 0.5f)); mBubbleContainer.setSystemGestureExclusionRects(mSystemGestureExclusionRects); } else { excludeZone.setEmpty(); mBubbleContainer.setSystemGestureExclusionRects(Collections.emptyList()); } } /** /** * Updates the visibility of the 'dot' indicating an update on the bubble. * Updates the visibility of the 'dot' indicating an update on the bubble. * @param key the {@link NotificationEntry#key} associated with the bubble. * @param key the {@link NotificationEntry#key} associated with the bubble. Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +26 −0 Original line number Original line Diff line number Diff line Loading @@ -64,6 +64,8 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.RoundingMode; import java.math.RoundingMode; import java.util.Collections; import java.util.List; /** /** * Renders bubbles in a stack and handles animating expanded and collapsed states. * Renders bubbles in a stack and handles animating expanded and collapsed states. Loading Loading @@ -164,6 +166,8 @@ public class BubbleStackView extends FrameLayout { int[] mTempLoc = new int[2]; int[] mTempLoc = new int[2]; RectF mTempRect = new RectF(); RectF mTempRect = new RectF(); private final List<Rect> mSystemGestureExclusionRects = Collections.singletonList(new Rect()); private ViewTreeObserver.OnPreDrawListener mViewUpdater = private ViewTreeObserver.OnPreDrawListener mViewUpdater = new ViewTreeObserver.OnPreDrawListener() { new ViewTreeObserver.OnPreDrawListener() { @Override @Override Loading @@ -175,6 +179,9 @@ public class BubbleStackView extends FrameLayout { } } }; }; private ViewTreeObserver.OnDrawListener mSystemGestureExcludeUpdater = this::updateSystemGestureExcludeRects; private ViewClippingUtil.ClippingParameters mClippingParameters = private ViewClippingUtil.ClippingParameters mClippingParameters = new ViewClippingUtil.ClippingParameters() { new ViewClippingUtil.ClippingParameters() { Loading Loading @@ -296,6 +303,9 @@ public class BubbleStackView extends FrameLayout { () -> mExpandedBubble.expandedView.updateInsets(insets)); () -> mExpandedBubble.expandedView.updateInsets(insets)); return view.onApplyWindowInsets(insets); return view.onApplyWindowInsets(insets); }); }); // This must be a separate OnDrawListener since it should be called for every draw. getViewTreeObserver().addOnDrawListener(mSystemGestureExcludeUpdater); } } /** /** Loading Loading @@ -362,6 +372,22 @@ public class BubbleStackView extends FrameLayout { return false; return false; } } private void updateSystemGestureExcludeRects() { // Exclude the region occupied by the first BubbleView in the stack Rect excludeZone = mSystemGestureExclusionRects.get(0); if (mBubbleContainer.getChildCount() > 0) { View firstBubble = mBubbleContainer.getChildAt(0); excludeZone.set(firstBubble.getLeft(), firstBubble.getTop(), firstBubble.getRight(), firstBubble.getBottom()); excludeZone.offset((int) (firstBubble.getTranslationX() + 0.5f), (int) (firstBubble.getTranslationY() + 0.5f)); mBubbleContainer.setSystemGestureExclusionRects(mSystemGestureExclusionRects); } else { excludeZone.setEmpty(); mBubbleContainer.setSystemGestureExclusionRects(Collections.emptyList()); } } /** /** * Updates the visibility of the 'dot' indicating an update on the bubble. * Updates the visibility of the 'dot' indicating an update on the bubble. * @param key the {@link NotificationEntry#key} associated with the bubble. * @param key the {@link NotificationEntry#key} associated with the bubble. Loading