Ensure overflow isn't selected when bar is collapsed am: 16b05e251b

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23900933

Change-Id: I19c19e06e387ce56a78d10b8251edf8449ceb989
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Liran Binyamin
2023-07-05 19:15:12 +00:00
committed by Automerger Merge Worker
3 changed files with 25 additions and 0 deletions
@@ -184,6 +184,8 @@ public class BubbleBarController extends IBubblesListener.Stub {
bubbleControllers.runAfterInit(() -> {
mBubbleBarViewController.setHiddenForBubbles(!BUBBLE_BAR_ENABLED);
mBubbleStashedHandleViewController.setHiddenForBubbles(!BUBBLE_BAR_ENABLED);
mBubbleBarViewController.setUpdateSelectedBubbleAfterCollapse(
key -> setSelectedBubble(mBubbles.get(key)));
});
}
@@ -32,6 +32,7 @@ import com.android.launcher3.taskbar.TaskbarActivityContext;
import com.android.launcher3.views.ActivityContext;
import java.util.List;
import java.util.function.Consumer;
/**
* The view that holds all the bubble views. Modifying this view should happen through
@@ -101,6 +102,9 @@ public class BubbleBarView extends FrameLayout {
@Nullable
private Runnable mReorderRunnable;
@Nullable
private Consumer<String> mUpdateSelectedBubbleAfterCollapse;
public BubbleBarView(Context context) {
this(context, null);
}
@@ -144,6 +148,13 @@ public class BubbleBarView extends FrameLayout {
mReorderRunnable.run();
mReorderRunnable = null;
}
// If the bar was just collapsed and the overflow was the last bubble that was
// selected, set the first bubble as selected.
if (!mIsBarExpanded && mUpdateSelectedBubbleAfterCollapse != null
&& mSelectedBubbleView.getBubble() instanceof BubbleBarOverflow) {
BubbleView firstBubble = (BubbleView) getChildAt(0);
mUpdateSelectedBubbleAfterCollapse.accept(firstBubble.getBubble().getKey());
}
updateWidth();
}
@@ -293,6 +304,11 @@ public class BubbleBarView extends FrameLayout {
}
}
public void setUpdateSelectedBubbleAfterCollapse(
Consumer<String> updateSelectedBubbleAfterCollapse) {
mUpdateSelectedBubbleAfterCollapse = updateSelectedBubbleAfterCollapse;
}
/**
* Sets which bubble view should be shown as selected.
*/
@@ -36,6 +36,7 @@ import com.android.quickstep.SystemUiProxy;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
/**
* Controller for {@link BubbleBarView}. Manages the visibility of the bubble bar as well as
@@ -184,6 +185,12 @@ public class BubbleBarViewController {
}
}
/** Sets a callback that updates the selected bubble after the bubble bar collapses. */
public void setUpdateSelectedBubbleAfterCollapse(
Consumer<String> updateSelectedBubbleAfterCollapse) {
mBarView.setUpdateSelectedBubbleAfterCollapse(updateSelectedBubbleAfterCollapse);
}
/**
* Sets whether the bubble bar should be hidden due to SysUI state (e.g. on lockscreen).
*/