Space out empty taskbar hotseat views when on home screen

This ensures the taskbar hotseat aligns with the home screen
hotseat, as the latter supports empty cells. When in apps,
the taskbar still collapses the empty cells.

Test: Turn off hotseat predictions, remove some hotseat items,
and ensure the taskbar hotseat spreads out when on home.

Bug: 179886115
Bug: 171917176
Change-Id: I6047c3c5691685edcd8b3519e0305812b1295550
This commit is contained in:
Tony Wickham
2021-03-03 17:33:28 -08:00
parent 634f600848
commit 64edc22c8b
2 changed files with 56 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_BOTT
import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_EXTRA_NAVIGATION_BAR;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.ActivityOptions;
import android.content.ComponentName;
import android.graphics.PixelFormat;
@@ -84,6 +85,8 @@ public class TaskbarController {
// Contains all loaded Hotseat items.
private ItemInfo[] mLatestLoadedHotseatItems;
private boolean mIsAnimatingToLauncher;
public TaskbarController(BaseQuickstepLauncher launcher,
TaskbarContainerView taskbarContainerView) {
mLauncher = launcher;
@@ -169,6 +172,14 @@ public class TaskbarController {
public View.OnLongClickListener getItemOnLongClickListener() {
return mDragController::startDragOnLongClick;
}
@Override
public int getEmptyHotseatViewVisibility() {
// When on the home screen, we want the empty hotseat views to take up their full
// space so that the others line up with the home screen hotseat.
return mLauncher.hasBeenResumed() || mIsAnimatingToLauncher
? View.INVISIBLE : View.GONE;
}
};
}
@@ -290,8 +301,6 @@ public class TaskbarController {
* @param toState If known, the state we will end up in when reaching Launcher.
*/
public Animator createAnimToLauncher(@Nullable LauncherState toState, long duration) {
alignRealHotseatWithTaskbar();
PendingAnimation anim = new PendingAnimation(duration);
anim.add(mTaskbarVisibilityController.createAnimToBackgroundAlpha(0, duration));
if (toState != null) {
@@ -299,6 +308,22 @@ public class TaskbarController {
}
anim.addFloat(mTaskbarView, SCALE_PROPERTY, mTaskbarView.getScaleX(),
getTaskbarScaleOnHome(), LINEAR);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mIsAnimatingToLauncher = true;
mTaskbarView.updateHotseatItemsVisibility();
}
@Override
public void onAnimationEnd(Animator animation) {
mIsAnimatingToLauncher = false;
}
});
anim.addOnFrameCallback(this::alignRealHotseatWithTaskbar);
return anim.buildAnim();
}
@@ -306,6 +331,12 @@ public class TaskbarController {
PendingAnimation anim = new PendingAnimation(duration);
anim.add(mTaskbarVisibilityController.createAnimToBackgroundAlpha(1, duration));
anim.addFloat(mTaskbarView, SCALE_PROPERTY, mTaskbarView.getScaleX(), 1f, LINEAR);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mTaskbarView.updateHotseatItemsVisibility();
}
});
return anim.buildAnim();
}
@@ -447,6 +478,7 @@ public class TaskbarController {
protected interface TaskbarViewCallbacks {
View.OnClickListener getItemOnClickListener();
View.OnLongClickListener getItemOnLongClickListener();
int getEmptyHotseatViewVisibility();
}
/**