Move taskbar to be closer to QSB

- Offset taskbar to be halfway between QSB and bottom of the screen.
- Add taskbar translationY state property to animate when going
  between launcher and an app.
- Draw the taskbar background in TaskbarContainerView instead of
  TaskbarView so it stays pinned to the bottom as TaskbarView
  translates up. If we want to have a background behind the
  taskbar on home, this should move back to TaskbarView so that
  the drawing can be shared by mTaskbarViewOnHome.

Test: visually on home screen, translates when entering and
exiting an app

Bug: 182981881
Bug: 171917176
Change-Id: I44f8b2c770074f7f015dcccbc2befd3453811193
This commit is contained in:
Tony Wickham
2021-04-07 11:06:40 -07:00
parent be282e9bc8
commit 81f8175ab1
10 changed files with 114 additions and 35 deletions

View File

@@ -50,6 +50,10 @@ public class TaskbarAnimationController {
private final AnimatedFloat mTaskbarScaleForLauncherState = new AnimatedFloat(
this::updateScale);
// TranslationY.
private final AnimatedFloat mTaskbarTranslationYForLauncherState = new AnimatedFloat(
this::updateTranslationY);
public TaskbarAnimationController(BaseQuickstepLauncher launcher,
TaskbarController.TaskbarAnimationControllerCallbacks taskbarCallbacks) {
mLauncher = launcher;
@@ -81,6 +85,10 @@ public class TaskbarAnimationController {
return mTaskbarScaleForLauncherState;
}
protected AnimatedFloat getTaskbarTranslationYForLauncherState() {
return mTaskbarTranslationYForLauncherState;
}
protected Animator createAnimToBackgroundAlpha(float toAlpha, long duration) {
return mTaskbarBackgroundAlpha.animateToValue(mTaskbarBackgroundAlpha.value, toAlpha)
.setDuration(duration);
@@ -95,6 +103,7 @@ public class TaskbarAnimationController {
mTaskbarCallbacks.updateTaskbarBackgroundAlpha(mTaskbarBackgroundAlpha.value);
updateVisibilityAlpha();
updateScale();
updateTranslationY();
}
private void updateVisibilityAlpha() {
@@ -120,6 +129,15 @@ public class TaskbarAnimationController {
mTaskbarCallbacks.updateTaskbarScale(scale);
}
private void updateTranslationY() {
// We use mTaskbarBackgroundAlpha as a proxy for whether Launcher is resumed/paused, the
// assumption being that Taskbar should always be at translationY 0f regardless of the
// current LauncherState if Launcher is paused.
float translationY = mTaskbarTranslationYForLauncherState.value;
translationY = Utilities.mapRange(mTaskbarBackgroundAlpha.value, translationY, 0f);
mTaskbarCallbacks.updateTaskbarTranslationY(translationY);
}
private void setNavBarButtonAlpha(float navBarAlpha) {
SystemUiProxy.INSTANCE.get(mLauncher).setNavBarButtonAlpha(navBarAlpha, false);
}