diff options
author | Tony Wickham <twickham@google.com> | 2020-12-23 16:12:18 -0600 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2021-01-29 21:22:00 +0000 |
commit | d683d98b34ffa75111f556f3b6950e89ba1fd13c (patch) | |
tree | 3f6856fbff608c15bf2ba9ad26230a32ec812871 /quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | |
parent | d4629656980f3d8d3b62ca50c784c27b137060fc (diff) |
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
Diffstat (limited to 'quickstep/src/com/android/launcher3/taskbar/TaskbarView.java')
-rw-r--r-- | quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 5df8d5f9cc..bf6e946f0d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -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)); } } |