Animate away Recent Apps section when going to home

Also fix calculation for divider position during this transition
when there are recent apps. Added tests as well.

Flag: com.android.launcher3.enable_recents_in_taskbar
Flag: com.android.window.flags.enable_desktop_windowing_taskbar_running_apps
Test: TaskbarViewControllerTest
Bug: 343522351

Change-Id: Ifffd620c1d4c156b37561584d6e3278b39804439
This commit is contained in:
Tony Wickham committed 2024-08-21 22:48:06 +00:00
1 parent cafe06f63d
commit 79f3cefae2
3 files changed
+326 -24

No files matched your search

@@ -108,9 +108,15 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
private long mAllAppsButtonTouchDelayMs;
private boolean mAllAppsTouchTriggered;
// Only non-null when device supports having an All Apps button.
// Only non-null when device supports having an All Apps button, or Recent Apps.
private @Nullable IconButtonView mTaskbarDivider;
/**
* Whether the divider is between Hotseat icons and Recents,
* instead of between All Apps button and Hotseat.
*/
private boolean mAddedDividerForRecents;
private final View mQsb;
private final float mTransientTaskbarMinWidth;
@@ -340,7 +346,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
protected void updateHotseatItems(ItemInfo[] hotseatItemInfos, List<GroupTask> recentTasks) {
int nextViewIndex = 0;
int numViewsAnimated = 0;
boolean addedDividerForRecents = false;
mAddedDividerForRecents = false;
if (mAllAppsButton != null) {
removeView(mAllAppsButton);
@@ -435,7 +441,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
if (mTaskbarDivider != null && !recentTasks.isEmpty()) {
addView(mTaskbarDivider, nextViewIndex++);
addedDividerForRecents = true;
mAddedDividerForRecents = true;
}
// Add Recent/Running icons.
@@ -499,10 +505,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
}
if (mAllAppsButton != null) {
addView(mAllAppsButton, mIsRtl ? getChildCount() : 0);
addView(mAllAppsButton, mIsRtl ? hotseatItemInfos.length : 0);
// If there are no recent tasks, add divider after All Apps (unless it's the only view).
if (!addedDividerForRecents && mTaskbarDivider != null && getChildCount() > 1) {
if (!mAddedDividerForRecents && mTaskbarDivider != null && getChildCount() > 1) {
addView(mTaskbarDivider, mIsRtl ? (getChildCount() - 1) : 1);
}
}
@@ -733,6 +739,14 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
return mTaskbarDivider;
}
/**
* Returns whether the divider is between Hotseat icons and Recents,
* instead of between All Apps button and Hotseat.
*/
public boolean isDividerForRecents() {
return mAddedDividerForRecents;
}
/**
* Returns the QSB in the taskbar.
*/