Animate taskbar background alpha and visibility alpha

Setup codepath to animate the Taskbar when going to and from Launcher,
primarily by listening for pause/resume signals but also hints from
gesture nav and AppToOverviewAnimationProvider.

Additionally, add TaskbarStateHandler to listen for Launcher state
changes if Taskbar is enabled. Combined, the end behavior is:

- Background alpha is 0 when Launcher is resumed, and 1 when Launcher
  is paused (we can make this animation more interesting later).
- Taskbar is always visible when Launcher is paused, otherwise its
  visibility is determined by multiple factors: LauncherState and
  whether the IME is showing.

Bug: 171917176
Change-Id: I7856fc979931c9d12d714dee11d179fd1b5a6968
This commit is contained in:
Tony Wickham
2020-12-23 16:12:18 -06:00
parent d462965698
commit d683d98b34
18 changed files with 392 additions and 11 deletions

View File

@@ -16,6 +16,7 @@
package com.android.launcher3.taskbar;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.widget.LinearLayout;
@@ -26,6 +27,9 @@ import androidx.annotation.Nullable;
* Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps.
*/
public class TaskbarView extends LinearLayout {
private final ColorDrawable mBackgroundDrawable;
public TaskbarView(@NonNull Context context) {
this(context, null);
}
@@ -42,5 +46,14 @@ public class TaskbarView extends LinearLayout {
public TaskbarView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mBackgroundDrawable = (ColorDrawable) getBackground();
}
/**
* Sets the alpha of the background color behind all the Taskbar contents.
* @param alpha 0 is fully transparent, 1 is fully opaque.
*/
public void setBackgroundAlpha(float alpha) {
mBackgroundDrawable.setAlpha((int) (alpha * 255));
}
}