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

@@ -45,6 +45,7 @@ import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.taskbar.TaskbarContainerView;
import com.android.launcher3.taskbar.TaskbarController;
import com.android.launcher3.taskbar.TaskbarStateHandler;
import com.android.launcher3.uioverrides.RecentsViewStateController;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.UiThreadHelper;
@@ -82,6 +83,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
private OverviewActionsView mActionsView;
private @Nullable TaskbarController mTaskbarController;
private final TaskbarStateHandler mTaskbarStateHandler = new TaskbarStateHandler(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -245,13 +247,23 @@ public abstract class BaseQuickstepLauncher extends Launcher
getWorkspace(),
getDepthController(),
new RecentsViewStateController(this),
new BackButtonAlphaHandler(this)};
new BackButtonAlphaHandler(this),
getTaskbarStateHandler(),
};
}
public DepthController getDepthController() {
return mDepthController;
}
public @Nullable TaskbarController getTaskbarController() {
return mTaskbarController;
}
public TaskbarStateHandler getTaskbarStateHandler() {
return mTaskbarStateHandler;
}
@Override
public void useFadeOutAnimationForLauncherStart(CancellationSignal signal) {
QuickstepAppTransitionManagerImpl appTransitionManager =
@@ -296,6 +308,12 @@ public abstract class BaseQuickstepLauncher extends Launcher
mDepthController.setActivityStarted(isStarted());
}
if ((changeBits & ACTIVITY_STATE_RESUMED) != 0) {
if (mTaskbarController != null) {
mTaskbarController.onLauncherResumedOrPaused(hasBeenResumed());
}
}
super.onActivityFlagsChanged(changeBits);
}