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
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index da41200..8496fd5 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -199,25 +199,38 @@
         int left = (r - l - qsbWidth) / 2;
         int right = left + qsbWidth;
 
-        DeviceProfile dp = mActivity.getDeviceProfile();
-        int freeSpace = dp.isTaskbarPresent
-                ? dp.workspacePadding.bottom
-                : dp.hotseatBarSizePx - dp.hotseatCellHeightPx - mQsbHeight;
-        int bottom = b - t
-                - (int) (freeSpace * QSB_CENTER_FACTOR)
-                - (dp.isTaskbarPresent ? dp.taskbarSize : dp.getInsets().bottom);
+        int bottom = b - t - getQsbOffsetY();
         int top = bottom - mQsbHeight;
         mQsb.layout(left, top, right, bottom);
 
         int taskbarWidth = mTaskbarView.getMeasuredWidth();
         left = (r - l - taskbarWidth) / 2;
         right = left + taskbarWidth;
-        bottom = b - t;
+        bottom = b - t - getTaskbarOffsetY();
         top = bottom - mTaskbarViewHeight;
         mTaskbarView.layout(left, top, right, bottom);
     }
 
     /**
+     * Returns the number of pixels the QSB is translated from the bottom of the screen.
+     */
+    private int getQsbOffsetY() {
+        DeviceProfile dp = mActivity.getDeviceProfile();
+        int freeSpace = dp.isTaskbarPresent
+                ? dp.workspacePadding.bottom
+                : dp.hotseatBarSizePx - dp.hotseatCellHeightPx - mQsbHeight;
+        return (int) (freeSpace * QSB_CENTER_FACTOR)
+                + (dp.isTaskbarPresent ? dp.taskbarSize : dp.getInsets().bottom);
+    }
+
+    /**
+     * Returns the number of pixels the taskbar is translated from the bottom of the screen.
+     */
+    public int getTaskbarOffsetY() {
+        return (getQsbOffsetY() - mTaskbarViewHeight) / 2;
+    }
+
+    /**
      * Sets the alpha value of just our ShortcutAndWidgetContainer.
      */
     public void setIconsAlpha(float alpha) {
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 0c509a1..58df9c8 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -184,6 +184,10 @@
         return launcher.getNormalTaskbarScale();
     }
 
+    public float getTaskbarTranslationY(Launcher launcher) {
+        return -launcher.getHotseat().getTaskbarOffsetY();
+    }
+
     public float getOverviewFullscreenProgress() {
         return 0;
     }