Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +15 −3 Original line number Diff line number Diff line Loading @@ -198,6 +198,11 @@ public class BubbleController implements ConfigurationController.ConfigurationLi /** Last known orientation, used to detect orientation changes in {@link #onConfigChanged}. */ private int mOrientation = Configuration.ORIENTATION_UNDEFINED; /** * Last known screen density, used to detect display size changes in {@link #onConfigChanged}. */ private int mDensityDpi = Configuration.DENSITY_DPI_UNDEFINED; private boolean mInflateSynchronously; // TODO (b/145659174): allow for multiple callbacks to support the "shadow" new notif pipeline Loading Loading @@ -705,10 +710,17 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void onConfigChanged(Configuration newConfig) { if (mStackView != null && newConfig != null && newConfig.orientation != mOrientation) { if (mStackView != null && newConfig != null) { if (newConfig.orientation != mOrientation) { mOrientation = newConfig.orientation; mStackView.onOrientationChanged(newConfig.orientation); } if (newConfig.densityDpi != mDensityDpi) { mDensityDpi = newConfig.densityDpi; mBubbleIconFactory = new BubbleIconFactory(mContext); mStackView.onDisplaySizeChanged(); } } } /** Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.java +7 −5 Original line number Diff line number Diff line Loading @@ -58,12 +58,13 @@ public class BubbleOverflow implements BubbleViewProvider { public BubbleOverflow(Context context) { mContext = context; mInflater = LayoutInflater.from(context); } void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) { mBitmapSize = mContext.getResources().getDimensionPixelSize(R.dimen.bubble_bitmap_size); mIconBitmapSize = mContext.getResources().getDimensionPixelSize( R.dimen.bubble_overflow_icon_bitmap_size); } void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) { mExpandedView = (BubbleExpandedView) mInflater.inflate( R.layout.bubble_expanded_view, parentViewGroup /* root */, false /* attachToRoot */); Loading @@ -74,6 +75,7 @@ public class BubbleOverflow implements BubbleViewProvider { } void updateIcon(Context context, ViewGroup parentViewGroup) { mContext = context; mInflater = LayoutInflater.from(context); mOverflowBtn = (BadgedImageView) mInflater.inflate(R.layout.bubble_overflow_button, parentViewGroup /* root */, Loading @@ -87,7 +89,7 @@ public class BubbleOverflow implements BubbleViewProvider { ta.recycle(); TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true); mContext.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true); int colorAccent = mContext.getColor(typedValue.resourceId); mOverflowBtn.getDrawable().setTint(colorAccent); mDotColor = colorAccent; Loading @@ -97,7 +99,7 @@ public class BubbleOverflow implements BubbleViewProvider { mBitmapSize - mIconBitmapSize /* inset */); AdaptiveIconDrawable adaptiveIconDrawable = new AdaptiveIconDrawable(bg, fg); BubbleIconFactory iconFactory = new BubbleIconFactory(context); BubbleIconFactory iconFactory = new BubbleIconFactory(mContext); mIcon = iconFactory.createBadgedIconBitmap(adaptiveIconDrawable, null /* user */, true /* shrinkNonAdaptiveIcons */).icon; Loading @@ -106,7 +108,7 @@ public class BubbleOverflow implements BubbleViewProvider { null /* outBounds */, null /* path */, null /* outMaskShape */); float radius = DEFAULT_PATH_SIZE / 2f; mPath = PathParser.createPathFromPathData( context.getResources().getString(com.android.internal.R.string.config_icon_mask)); mContext.getResources().getString(com.android.internal.R.string.config_icon_mask)); Matrix matrix = new Matrix(); matrix.setScale(scale /* x scale */, scale /* y scale */, radius /* pivot x */, radius /* pivot y */); Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +28 −11 Original line number Diff line number Diff line Loading @@ -790,8 +790,8 @@ public class BubbleStackView extends FrameLayout mOrientationChangedListener = (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { mExpandedAnimationController.updateOrientation(mOrientation, mDisplaySize); mStackAnimationController.updateOrientation(mOrientation); mExpandedAnimationController.updateResources(mOrientation, mDisplaySize); mStackAnimationController.updateResources(mOrientation); // Reposition & adjust the height for new orientation if (mIsExpanded) { Loading Loading @@ -1054,6 +1054,28 @@ public class BubbleStackView extends FrameLayout mShowingManage = false; } /** Respond to the display size change by recalculating view size and location. */ public void onDisplaySizeChanged() { setUpOverflow(); WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getRealSize(mDisplaySize); Resources res = getContext().getResources(); mStatusBarHeight = res.getDimensionPixelSize( com.android.internal.R.dimen.status_bar_height); mBubblePaddingTop = res.getDimensionPixelSize(R.dimen.bubble_padding_top); mBubbleSize = getResources().getDimensionPixelSize(R.dimen.individual_bubble_size); for (Bubble b : mBubbleData.getBubbles()) { if (b.getIconView() == null) { Log.d(TAG, "Display size changed. Icon null: " + b); continue; } b.getIconView().setLayoutParams(new LayoutParams(mBubbleSize, mBubbleSize)); } mExpandedAnimationController.updateResources(mOrientation, mDisplaySize); mStackAnimationController.updateResources(mOrientation); } @Override public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo inoutInfo) { inoutInfo.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION); Loading Loading @@ -1294,7 +1316,7 @@ public class BubbleStackView extends FrameLayout Log.d(TAG, "was asked to remove Bubble, but didn't find the view! " + bubble); } private void updateOverflowBtnVisibility(boolean apply) { private void updateOverflowBtnVisibility() { if (!BubbleExperimentConfig.allowBubbleOverflow(mContext)) { return; } Loading @@ -1303,11 +1325,6 @@ public class BubbleStackView extends FrameLayout Log.d(TAG, "Show overflow button."); } mBubbleOverflow.setBtnVisible(VISIBLE); if (apply) { mExpandedAnimationController.expandFromStack(() -> { updatePointerPosition(); } /* after */); } } else { if (DEBUG_BUBBLE_STACK_VIEW) { Log.d(TAG, "Collapsed. Hide overflow button."); Loading Loading @@ -1567,7 +1584,7 @@ public class BubbleStackView extends FrameLayout Log.d(TAG, BubbleDebugConfig.formatBubblesString(getBubblesOnScreen(), mExpandedBubble)); } updateOverflowBtnVisibility(/* apply */ false); updateOverflowBtnVisibility(); mBubbleContainer.cancelAllAnimations(); mExpandedAnimationController.collapseBackToStack( mStackAnimationController.getStackPositionAlongNearestHorizontalEdge() Loading @@ -1591,7 +1608,7 @@ public class BubbleStackView extends FrameLayout beforeExpandedViewAnimation(); mBubbleContainer.setActiveController(mExpandedAnimationController); updateOverflowBtnVisibility(/* apply */ false); updateOverflowBtnVisibility(); mExpandedAnimationController.expandFromStack(() -> { updatePointerPosition(); afterExpandedViewAnimation(); Loading packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ public class ExpandedAnimationController public ExpandedAnimationController(Point displaySize, int expandedViewPadding, int orientation) { updateOrientation(orientation, displaySize); updateResources(orientation, displaySize); mExpandedViewPadding = expandedViewPadding; } Loading Loading @@ -168,7 +168,7 @@ public class ExpandedAnimationController * @param orientation Landscape or portrait. * @param displaySize Updated display size. */ public void updateOrientation(int orientation, Point displaySize) { public void updateResources(int orientation, Point displaySize) { mScreenOrientation = orientation; mDisplaySize = displaySize; if (mLayout != null) { Loading packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java +1 −1 Original line number Diff line number Diff line Loading @@ -809,7 +809,7 @@ public class StackAnimationController extends * Update effective screen width based on current orientation. * @param orientation Landscape or portrait. */ public void updateOrientation(int orientation) { public void updateResources(int orientation) { if (mLayout != null) { Resources res = mLayout.getContext().getResources(); mBubblePaddingTop = res.getDimensionPixelSize(R.dimen.bubble_padding_top); Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +15 −3 Original line number Diff line number Diff line Loading @@ -198,6 +198,11 @@ public class BubbleController implements ConfigurationController.ConfigurationLi /** Last known orientation, used to detect orientation changes in {@link #onConfigChanged}. */ private int mOrientation = Configuration.ORIENTATION_UNDEFINED; /** * Last known screen density, used to detect display size changes in {@link #onConfigChanged}. */ private int mDensityDpi = Configuration.DENSITY_DPI_UNDEFINED; private boolean mInflateSynchronously; // TODO (b/145659174): allow for multiple callbacks to support the "shadow" new notif pipeline Loading Loading @@ -705,10 +710,17 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void onConfigChanged(Configuration newConfig) { if (mStackView != null && newConfig != null && newConfig.orientation != mOrientation) { if (mStackView != null && newConfig != null) { if (newConfig.orientation != mOrientation) { mOrientation = newConfig.orientation; mStackView.onOrientationChanged(newConfig.orientation); } if (newConfig.densityDpi != mDensityDpi) { mDensityDpi = newConfig.densityDpi; mBubbleIconFactory = new BubbleIconFactory(mContext); mStackView.onDisplaySizeChanged(); } } } /** Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.java +7 −5 Original line number Diff line number Diff line Loading @@ -58,12 +58,13 @@ public class BubbleOverflow implements BubbleViewProvider { public BubbleOverflow(Context context) { mContext = context; mInflater = LayoutInflater.from(context); } void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) { mBitmapSize = mContext.getResources().getDimensionPixelSize(R.dimen.bubble_bitmap_size); mIconBitmapSize = mContext.getResources().getDimensionPixelSize( R.dimen.bubble_overflow_icon_bitmap_size); } void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) { mExpandedView = (BubbleExpandedView) mInflater.inflate( R.layout.bubble_expanded_view, parentViewGroup /* root */, false /* attachToRoot */); Loading @@ -74,6 +75,7 @@ public class BubbleOverflow implements BubbleViewProvider { } void updateIcon(Context context, ViewGroup parentViewGroup) { mContext = context; mInflater = LayoutInflater.from(context); mOverflowBtn = (BadgedImageView) mInflater.inflate(R.layout.bubble_overflow_button, parentViewGroup /* root */, Loading @@ -87,7 +89,7 @@ public class BubbleOverflow implements BubbleViewProvider { ta.recycle(); TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true); mContext.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true); int colorAccent = mContext.getColor(typedValue.resourceId); mOverflowBtn.getDrawable().setTint(colorAccent); mDotColor = colorAccent; Loading @@ -97,7 +99,7 @@ public class BubbleOverflow implements BubbleViewProvider { mBitmapSize - mIconBitmapSize /* inset */); AdaptiveIconDrawable adaptiveIconDrawable = new AdaptiveIconDrawable(bg, fg); BubbleIconFactory iconFactory = new BubbleIconFactory(context); BubbleIconFactory iconFactory = new BubbleIconFactory(mContext); mIcon = iconFactory.createBadgedIconBitmap(adaptiveIconDrawable, null /* user */, true /* shrinkNonAdaptiveIcons */).icon; Loading @@ -106,7 +108,7 @@ public class BubbleOverflow implements BubbleViewProvider { null /* outBounds */, null /* path */, null /* outMaskShape */); float radius = DEFAULT_PATH_SIZE / 2f; mPath = PathParser.createPathFromPathData( context.getResources().getString(com.android.internal.R.string.config_icon_mask)); mContext.getResources().getString(com.android.internal.R.string.config_icon_mask)); Matrix matrix = new Matrix(); matrix.setScale(scale /* x scale */, scale /* y scale */, radius /* pivot x */, radius /* pivot y */); Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +28 −11 Original line number Diff line number Diff line Loading @@ -790,8 +790,8 @@ public class BubbleStackView extends FrameLayout mOrientationChangedListener = (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { mExpandedAnimationController.updateOrientation(mOrientation, mDisplaySize); mStackAnimationController.updateOrientation(mOrientation); mExpandedAnimationController.updateResources(mOrientation, mDisplaySize); mStackAnimationController.updateResources(mOrientation); // Reposition & adjust the height for new orientation if (mIsExpanded) { Loading Loading @@ -1054,6 +1054,28 @@ public class BubbleStackView extends FrameLayout mShowingManage = false; } /** Respond to the display size change by recalculating view size and location. */ public void onDisplaySizeChanged() { setUpOverflow(); WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getRealSize(mDisplaySize); Resources res = getContext().getResources(); mStatusBarHeight = res.getDimensionPixelSize( com.android.internal.R.dimen.status_bar_height); mBubblePaddingTop = res.getDimensionPixelSize(R.dimen.bubble_padding_top); mBubbleSize = getResources().getDimensionPixelSize(R.dimen.individual_bubble_size); for (Bubble b : mBubbleData.getBubbles()) { if (b.getIconView() == null) { Log.d(TAG, "Display size changed. Icon null: " + b); continue; } b.getIconView().setLayoutParams(new LayoutParams(mBubbleSize, mBubbleSize)); } mExpandedAnimationController.updateResources(mOrientation, mDisplaySize); mStackAnimationController.updateResources(mOrientation); } @Override public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo inoutInfo) { inoutInfo.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION); Loading Loading @@ -1294,7 +1316,7 @@ public class BubbleStackView extends FrameLayout Log.d(TAG, "was asked to remove Bubble, but didn't find the view! " + bubble); } private void updateOverflowBtnVisibility(boolean apply) { private void updateOverflowBtnVisibility() { if (!BubbleExperimentConfig.allowBubbleOverflow(mContext)) { return; } Loading @@ -1303,11 +1325,6 @@ public class BubbleStackView extends FrameLayout Log.d(TAG, "Show overflow button."); } mBubbleOverflow.setBtnVisible(VISIBLE); if (apply) { mExpandedAnimationController.expandFromStack(() -> { updatePointerPosition(); } /* after */); } } else { if (DEBUG_BUBBLE_STACK_VIEW) { Log.d(TAG, "Collapsed. Hide overflow button."); Loading Loading @@ -1567,7 +1584,7 @@ public class BubbleStackView extends FrameLayout Log.d(TAG, BubbleDebugConfig.formatBubblesString(getBubblesOnScreen(), mExpandedBubble)); } updateOverflowBtnVisibility(/* apply */ false); updateOverflowBtnVisibility(); mBubbleContainer.cancelAllAnimations(); mExpandedAnimationController.collapseBackToStack( mStackAnimationController.getStackPositionAlongNearestHorizontalEdge() Loading @@ -1591,7 +1608,7 @@ public class BubbleStackView extends FrameLayout beforeExpandedViewAnimation(); mBubbleContainer.setActiveController(mExpandedAnimationController); updateOverflowBtnVisibility(/* apply */ false); updateOverflowBtnVisibility(); mExpandedAnimationController.expandFromStack(() -> { updatePointerPosition(); afterExpandedViewAnimation(); Loading
packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -118,7 +118,7 @@ public class ExpandedAnimationController public ExpandedAnimationController(Point displaySize, int expandedViewPadding, int orientation) { updateOrientation(orientation, displaySize); updateResources(orientation, displaySize); mExpandedViewPadding = expandedViewPadding; } Loading Loading @@ -168,7 +168,7 @@ public class ExpandedAnimationController * @param orientation Landscape or portrait. * @param displaySize Updated display size. */ public void updateOrientation(int orientation, Point displaySize) { public void updateResources(int orientation, Point displaySize) { mScreenOrientation = orientation; mDisplaySize = displaySize; if (mLayout != null) { Loading
packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java +1 −1 Original line number Diff line number Diff line Loading @@ -809,7 +809,7 @@ public class StackAnimationController extends * Update effective screen width based on current orientation. * @param orientation Landscape or portrait. */ public void updateOrientation(int orientation) { public void updateResources(int orientation) { if (mLayout != null) { Resources res = mLayout.getContext().getResources(); mBubblePaddingTop = res.getDimensionPixelSize(R.dimen.bubble_padding_top); Loading