Merge "Unify calls to sysuiProxy#showBubble into one method" into udc-qpr-dev am: 3e952e034c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/24010037 Change-Id: Id9470422fa6e14e59432ef859cde823b3f588aa7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -118,6 +118,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
|||||||
private final Executor mMainExecutor;
|
private final Executor mMainExecutor;
|
||||||
private final LauncherApps mLauncherApps;
|
private final LauncherApps mLauncherApps;
|
||||||
private final BubbleIconFactory mIconFactory;
|
private final BubbleIconFactory mIconFactory;
|
||||||
|
private final SystemUiProxy mSystemUiProxy;
|
||||||
|
|
||||||
private BubbleBarItem mSelectedBubble;
|
private BubbleBarItem mSelectedBubble;
|
||||||
private BubbleBarOverflow mOverflowBubble;
|
private BubbleBarOverflow mOverflowBubble;
|
||||||
@@ -159,8 +160,10 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
|||||||
mContext = context;
|
mContext = context;
|
||||||
mBarView = bubbleView; // Need the view for inflating bubble views.
|
mBarView = bubbleView; // Need the view for inflating bubble views.
|
||||||
|
|
||||||
|
mSystemUiProxy = SystemUiProxy.INSTANCE.get(context);
|
||||||
|
|
||||||
if (BUBBLE_BAR_ENABLED) {
|
if (BUBBLE_BAR_ENABLED) {
|
||||||
SystemUiProxy.INSTANCE.get(context).setBubblesListener(this);
|
mSystemUiProxy.setBubblesListener(this);
|
||||||
}
|
}
|
||||||
mMainExecutor = MAIN_EXECUTOR;
|
mMainExecutor = MAIN_EXECUTOR;
|
||||||
mLauncherApps = context.getSystemService(LauncherApps.class);
|
mLauncherApps = context.getSystemService(LauncherApps.class);
|
||||||
@@ -173,7 +176,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
SystemUiProxy.INSTANCE.get(mContext).setBubblesListener(null);
|
mSystemUiProxy.setBubblesListener(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(TaskbarControllers controllers, BubbleControllers bubbleControllers) {
|
public void init(TaskbarControllers controllers, BubbleControllers bubbleControllers) {
|
||||||
@@ -354,12 +357,33 @@ public class BubbleBarController extends IBubblesListener.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Tells WMShell to show the currently selected bubble. */
|
||||||
|
public void showSelectedBubble() {
|
||||||
|
if (getSelectedBubbleKey() != null) {
|
||||||
|
int[] bubbleBarCoords = mBarView.getLocationOnScreen();
|
||||||
|
if (mSelectedBubble instanceof BubbleBarBubble) {
|
||||||
|
// TODO (b/269670235): hide the update dot on the view if needed.
|
||||||
|
}
|
||||||
|
mSystemUiProxy.showBubble(getSelectedBubbleKey(),
|
||||||
|
bubbleBarCoords[0], bubbleBarCoords[1]);
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Trying to show the selected bubble but it's null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Updates the currently selected bubble for launcher views and tells WMShell to show it. */
|
||||||
|
public void showAndSelectBubble(BubbleBarItem b) {
|
||||||
|
if (DEBUG) Log.w(TAG, "showingSelectedBubble: " + b.getKey());
|
||||||
|
setSelectedBubble(b);
|
||||||
|
showSelectedBubble();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the bubble that should be selected. This notifies the views, it does not notify
|
* Sets the bubble that should be selected. This notifies the views, it does not notify
|
||||||
* WMShell that the selection has changed, that should go through
|
* WMShell that the selection has changed, that should go through either
|
||||||
* {@link SystemUiProxy#showBubble}.
|
* {@link #showSelectedBubble()} or {@link #showAndSelectBubble(BubbleBarItem)}.
|
||||||
*/
|
*/
|
||||||
public void setSelectedBubble(BubbleBarItem b) {
|
private void setSelectedBubble(BubbleBarItem b) {
|
||||||
if (!Objects.equals(b, mSelectedBubble)) {
|
if (!Objects.equals(b, mSelectedBubble)) {
|
||||||
if (DEBUG) Log.w(TAG, "selectingBubble: " + b.getKey());
|
if (DEBUG) Log.w(TAG, "selectingBubble: " + b.getKey());
|
||||||
mSelectedBubble = b;
|
mSelectedBubble = b;
|
||||||
|
|||||||
@@ -112,9 +112,7 @@ public class BubbleBarViewController {
|
|||||||
setExpanded(false);
|
setExpanded(false);
|
||||||
mBubbleStashController.stashBubbleBar();
|
mBubbleStashController.stashBubbleBar();
|
||||||
} else {
|
} else {
|
||||||
mBubbleBarController.setSelectedBubble(bubble);
|
mBubbleBarController.showAndSelectBubble(bubble);
|
||||||
int[] bubbleBarCoords = mBarView.getLocationOnScreen();
|
|
||||||
mSystemUiProxy.showBubble(bubble.getKey(), bubbleBarCoords[0], bubbleBarCoords[1]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,13 +289,7 @@ public class BubbleBarViewController {
|
|||||||
if (!isExpanded) {
|
if (!isExpanded) {
|
||||||
mSystemUiProxy.collapseBubbles();
|
mSystemUiProxy.collapseBubbles();
|
||||||
} else {
|
} else {
|
||||||
final String selectedKey = mBubbleBarController.getSelectedBubbleKey();
|
mBubbleBarController.showSelectedBubble();
|
||||||
if (selectedKey != null) {
|
|
||||||
int[] bubbleBarCoords = mBarView.getLocationOnScreen();
|
|
||||||
mSystemUiProxy.showBubble(selectedKey, bubbleBarCoords[0], bubbleBarCoords[1]);
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "trying to expand bubbles when there isn't one selected");
|
|
||||||
}
|
|
||||||
mTaskbarStashController.updateAndAnimateTransientTaskbar(true /* stash */,
|
mTaskbarStashController.updateAndAnimateTransientTaskbar(true /* stash */,
|
||||||
false /* shouldBubblesFollow */);
|
false /* shouldBubblesFollow */);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user