Commit Graph

12 Commits

Author SHA1 Message Date
Tony Wickham
64edc22c8b Space out empty taskbar hotseat views when on home screen
This ensures the taskbar hotseat aligns with the home screen
hotseat, as the latter supports empty cells. When in apps,
the taskbar still collapses the empty cells.

Test: Turn off hotseat predictions, remove some hotseat items,
and ensure the taskbar hotseat spreads out when on home.

Bug: 179886115
Bug: 171917176
Change-Id: I6047c3c5691685edcd8b3519e0305812b1295550
2021-03-04 23:54:34 +00:00
Tony Wickham
a29a046d83 Align real hotseat with taskbar hotseat during drag and drop
Remove hotseat space from workspace in DeviceProfile if
taskbar is present, and instantly swap between taskbar and
hotseat when entering SpringLoadedMode. To allow for an exact
handoff, we also scale up the TaskbarView such that its icons
match the hotseat icon size when on the home screen.

Note that this CL only supports dragging to the taskbar, not
out of it (which still triggers system drag and drop instead).

Test: In RTL and LTR, drag a workspace item and ensure hotseat
seamlessly swaps with the taskbar hotseat and allows drops.

Bug: 179886115
Bug: 171917176

Change-Id: Id6462075b9b0b66b06d51a78c9c0b3e11e83e84d
2021-03-03 11:16:42 -08:00
Tony Wickham
786dd93f2b Fix a couple of crashes when taskbar isn't yet attached
- Handle back to back addTaskbarIfNecessary(). Specifically, handle
  cleanup() before the previous add was attached. This is already
  handled on WM side, just had to remove isAttachedToWindow() check.
- Add isAttachedToWindow() check to isViewInTaskbar()

Test: call addTaskbarIfNecessary() three times back to back, ensure no crash.

Fixes: 180509238
Bug: 171917176
Change-Id: Id68b6c376029eb5c651f47afa56666391c516aef
2021-02-18 15:40:33 -08:00
Tony Wickham
15883891ea Subtract taskbar size from DeviceProfile#availableHeight
Normally availableHeight excludes system insets, but taskbar is added
after availableHeight is calculated. This discrepency causes some bad
calculations such as TaskView size.

Test: touch nav bar when in an app with taskbar present, ensure the
task doesn't jump due to incorrect calculation

Fixes: 179478728
Bug: 171917176
Change-Id: I16d39d3e1d9708e2a64c81b1ac24466f9567d1b9
2021-02-18 11:39:10 -08:00
Tony Wickham
7ba547cd2d Folder support in Taskbar
- Add TaskbarActivityContext which allows shared Launcher elements to
  "just work" using existing generic ActivityContext.
- TaskbarContainerView extends BaseDragLayer<TaskbarActivityContext>.
- Inflate FolderIcon and Folder using TaskbarActivityContext to be
  shown in TaskbarContainerView.
- Use TaskbarActivityContext's DeviceProfile to determine icon size
  instead of overriding in styles. This also ensures that normal
  BubbleTextView icons have the same size as FolderIcons.

Test: Place a folder in home screen hotseat, ensure it shows up in
taskbar and can be opened, and that apps inside it can be launched
or dragged.
Bug: 171917176

Change-Id: Ic25d2f84bcd7e3399c88989305ea565497c030d9
2021-02-16 15:07:01 -08:00
Tony Wickham
734be0b5ae Add OnComputeInsetsListener to TaskbarContainerView
Instead of updating visibility of TaskbarContainerView, keep it
VISIBLE but with alpha 0, and update touchableInsets to allow
touches to pass through. This avoids sending insets changed
when Taskbar is hidden.

Test: Swipe to Overview, no jumping/jank due to insets change;
also tap where Taskbar would be and ensure it doesn't launch

Bug: 171917176
Change-Id: I9ccb4335e0301f34eec459657f3bbaf88b0d8a52
2021-02-05 08:51:42 -08:00
Tony Wickham
63fc59b801 Use SYSTEM_APPLICATION_OVERLAY instead of SYSTEM_ALERT_WINDOW for Taskbar
Test: Taskbar still shows up and works, can't hide it from Settings
Bug: 169054709
Change-Id: I0d2f9be8a0af2242472d8406bbc31a6aecaa9285
2021-02-04 10:07:59 -08:00
Tony Wickham
aaa42bd0e8 Add recent tasks to Taskbar
- Also adds a divider between Hotseat and Recents
- Dedupes Recents from Hotseat

Test: Open some recent tasks, ensure they are deduped
from Hotseat and also handle < 2 tasks.

Bug: 171917176
Change-Id: Ia782c6ccbcda94cfd844aad04dc3d25a3f072c2b
2021-02-03 18:54:58 -08:00
Tony Wickham
e747278ee8 Support drag and drop from Taskbar
- Long clicking a BubbleTextView in Taskbar will start a system drag
  and drop operation, setting the original view invisible meanwhile.
- Defer gesture navigation when starting over a Taskbar item, and
  cancel any started gesture if a Taskbar drag and drop starts.

Bug: 171917176
Change-Id: If5049071fbf1755f545ee937daa4edabd869f00d
2021-02-01 18:29:06 -08:00
Tony Wickham
794fe4f58e Add Hotseat items to Taskbar
- Currently supports WorkspaceItemInfo (e.g. normal app icons
  including hotseat predictions and pinned deep shortcuts).
- Currently doesn't support Folders, Notification dots, or
  long press.

Some technical details:
- Always allow HotseatPredictionController updates given the
  Hotseat is always showing even when Launcher is stopped.
- Represent Taskbar Hotseat items as BubbleTextViews, to
  allow for normal click handling etc. When the hotseat is
  updated, we reuse the same BubbleTextViews that were
  initially inflated, and just reapply the new info.
- Add new BubbleTextView iconDisplay for Taskbar, to allow
  for different treatment such as icon size.

Bug: 171917176
Change-Id: I325eb39051f2dc69228b39b5c40ed0cbdad8e200
2021-02-01 18:29:06 -08:00
Tony Wickham
d683d98b34 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
2021-01-29 21:22:00 +00:00
Tony Wickham
f26e90aa35 Add empty Taskbar views and initial TaskbarController
Guarded by a FeatureFlag.

Bug: 171917176
Change-Id: I7145c7ae68282bf53552502798fe758c8c0e285d
2021-01-22 15:39:46 -08:00