Commit Graph

1155 Commits

Author SHA1 Message Date
Steven Ng
a5e1453779 Reattach LauncherAppWidgetHostView to its parent after canceling drag
onDrop isn't called if the drag is canceled at Launcher.onPause. Let's
also reattach LauncherAppWidgetHostView to its parent in this case.

Test: long press and hold a widget and, at the same time, press the
      power button. Don't let go of the long press and press the power
      button. No crash observed.
Fix: 190950646
Change-Id: Id52a51291863b7ef63c861eb6dc23b015484be65
2021-06-15 00:01:04 +01:00
Andras Kloczl
dbf577af46 Add left widget panel to Launcher home when unfolded
Test: manual
Bug: 175939730
Change-Id: I9831e7fa95084db12953ec7cb2eb725e7549e01d
2021-06-14 12:22:05 +02:00
TreeHugger Robot
c13b47f7bf Merge "Fix CellLayout cast exception when drag is canceled" into sc-dev am: 76f5572648
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14948453

Change-Id: I4d23a6d0cc1806761bf9655ba8d823813ec8b630
2021-06-12 12:39:52 +00:00
Steven Ng
77a1393c44 Fix CellLayout cast exception when drag is canceled
Test: Long press a widget and then release when the resize frame is
      shown. Then, click the content of the widget to launch the
      widget's activity. Go back to home screen and then immediately
      long press the same widget again. No crash was observed.
Bug: 189814379
Change-Id: I4232ecf9d9d9efaba817b7777314f0814bb7ef21
2021-06-11 20:18:21 +01:00
Sunny Goyal
1721ccf385 Simplifying the drop animation code
> Removing some unused parameters

Bug: 190524398
Test: Manual
Change-Id: Iea0c2e7a9d30a10fd7443ea57992c59ea60badf8
2021-06-08 14:43:57 -07:00
Steven Ng
0ed1b41464 Merge "Exact widget sizes functionalities into an utility class" into sc-dev am: 84fe7e3a1e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14881307

Change-Id: I5202727f975ce463179674cd54ba8d4b75063f9d
2021-06-08 19:12:12 +00:00
Steven Ng
22b6039270 Exact widget sizes functionalities into an utility class
Test: resize widget, move widget, add widget.
Bug: 189975670
Change-Id: Ia0bc2297891e1cfa33697e985064db5d1dcdfc8b
2021-06-08 11:42:48 +01:00
Steven Ng
8e74a1f2a7 Merge "Show app widget resize frame after launcher state change" into sc-dev am: c58b204926
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14733440

Change-Id: I347e1fae2221f478cc7cab478e3924ea8a131eb8
2021-06-01 21:31:34 +00:00
Steven Ng
6ed0112871 Merge "Fix add extra empty screen logic" into sc-dev am: a45ea6cf33
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14717704

Change-Id: I69033f2b4ca9f3508ed31125bb9b74a09dd32829
2021-06-01 21:31:30 +00:00
Steven Ng
c58b204926 Merge "Show app widget resize frame after launcher state change" into sc-dev 2021-06-01 21:11:01 +00:00
Steven Ng
7e3d96c620 Show app widget resize frame after launcher state change
When this bug occurs, the resize frame coordinate is incorrect because
the launcher state animation has not finished when the drag view
finishes animating back to its original position.

Test: Quickly long press and release a widget from the home screen.
      Observe the resize frame is correctly shown around the widget.

Bug: 186370472
Change-Id: I6bfba2e85e3354a215c26203dd22df13db3b8b83
2021-06-01 12:20:32 +01:00
Steven Ng
1ef7e145d2 Fix add extra empty screen logic
The bug occurred when there are two widgets in a CellLayout. When
dragging one of the widget, ShortcutAndWidgetContainer#getChildCount
returns 1 rather than 2 because the LauncherAppWidgetHostView of the
widget in drag has been detached from its parent and reattached to
DragView (introduced in ag/14234627).

Test: Place only two widgets on the last page of the home screen. Drag
      one widget. The new page indicator on the right is shown.
Bug: 188494523
Change-Id: I8255dd1b72ad7f18f4cb35a9e14ac8e61804980c
2021-05-25 23:39:40 +01:00
Andras Kloczl
55edfe55f7 Add two panel home support for page binding logic
There's a logic which prioritizes the binding for the
current page and defers the other pages' binding.
If two panel home is enabled, we want to bind both pages
together. LauncherPageRestoreHelper has been created to
contain the logic for persisting restoring and calculating
which pages to load immediately.

Test: manual + run LauncherPageRestoreHelperTest robo test
Bug: 174464691
Change-Id: I57ac3f7150303b95b272e922f44bda26f9d5ce2a
2021-05-24 23:22:06 +02:00
Winson Chung
bd2fa26bda Tweak ordering of first match search
- Tweak iteration for finding first match, go by operator priority and
  check each cell layout by order to return the first view that matches
- Also reset the launch cookie in cases where we're launching a task
  that doesn't support cookies (ie. via prediction), otherwise we may
  still try to associate it with the last launched cookie later

Fixes: 187720286
Test: Swipe up from various icon types across hotseat/workspace
Change-Id: I71c4c13c442b0884b2247589685f976eaaeb30a4
Signed-off-by: Winson Chung <winsonc@google.com>
2021-05-20 14:50:33 -07:00
Sunny Goyal
01b32466c3 Revert "Revert "Exposing AnimatorListeners in StateManager to receive both success and failure callback""
This reverts commit d7f11d5fb9.

Reason for revert: Fixed initial error
Bug: 185554764

Change-Id: I32cc49f9b3820166736ceb347f33577939aa6efa
2021-05-13 10:23:35 -07:00
TreeHugger Robot
7c58b4c7dc Merge "Revert "Exposing AnimatorListeners in StateManager to receive both success and failure callback"" into sc-dev 2021-05-12 23:37:33 +00:00
Winson Chung
d7f11d5fb9 Revert "Exposing AnimatorListeners in StateManager to receive both success and failure callback"
This reverts commit a75f576890.

Reason for revert: b/187887269
Bug: 187887269

Change-Id: I8a56ff7054e71cf30b113fdaa213397dae0c53cb
2021-05-12 21:25:22 +00:00
TreeHugger Robot
d7c6e44ba9 Merge "Exposing AnimatorListeners in StateManager to receive both success and failure callback" into sc-dev 2021-05-11 22:21:42 +00:00
Winson Chung
76e27f6d5d Merge "End scroller if it has already reached the final position" into sc-dev 2021-05-11 21:52:45 +00:00
Sunny Goyal
a75f576890 Exposing AnimatorListeners in StateManager to receive both success and failure callback
Updating various callers to use onSuccess or onEnd appropriately

Test: Manual
Bug: 185554764
Change-Id: I357dd1fdbe111e7a30d4c8dee520fbd7d9956b7d
2021-05-11 13:53:14 -07:00
Winson Chung
8542541b2b End scroller if it has already reached the final position
- The system overscroller seems to take a long time to settle even
  after the final position has been reached, so if that has already
  happened and there is no edge effect, then just end the scroller.
- Remove unused code related to SmoothPageView

Bug: 184983443
Test: Quickswitch and ensure we finish the recents animation after it settles
Change-Id: I9fa72ddd6b6e0d38b6f622c776a2ac5f5b055760
2021-05-11 12:59:14 -07:00
Sunny Goyal
5996937798 Removing Launcher dependency from Folders
This allows opening/closing folders without a Launcher context

Bug: 187353581
Test: Manual
Change-Id: Id73a40445a23004eb554f0422d286aa0ff6b3c41
2021-05-10 14:01:43 -07:00
Sunny Goyal
19ff728b92 Adding support for determining split layout for launcher.
> Simulating the windo wmanager API to get available device
  profiles until final API
> When a device has multiple internal displays, and with both
  tablet and phone possibilities, it uses a split workspace layout

Bug: 186160341
Bug: 175782275
Test: Manual
Change-Id: Ieff2329acac7cdd6b9abe6f96cd459cd45bd0efe
2021-05-03 14:48:28 -07:00
Sunny Goyal
4ed0fb5074 Removing dependency on wallpaper colors and using theme resources
Bug: 184676715
Test: Manual
Change-Id: Ie9a9a784c4a8a8cd484bfd8ea463deedcd4deed6
2021-04-27 16:29:08 -07:00
Winson Chung
b837f5040e Merge "Add support for swiping back to the shortcut that launched the activity" into sc-dev 2021-04-23 07:37:37 +00:00
TreeHugger Robot
a8775d6ef9 Merge "New spring overscroll in pagedView" into sc-dev 2021-04-23 01:04:35 +00:00
Winson Chung
2b093941e1 Add support for swiping back to the shortcut that launched the activity
Bug: 129067201
Test: Open a shortcut on the workspace, go home

Change-Id: If5d3c3e8e93f09af50aa4994094657347890ef45
Signed-off-by: Winson Chung <winsonc@google.com>
2021-04-22 17:00:47 -07:00
Sunny Goyal
c39db7321f New spring overscroll in pagedView
> Using EdgeEffect in PagedView for overscroll
> Keeping RecentsView overscroll similar to S, by created a custom EdgeEffect

Bug: 183966408
Test: Manual
Change-Id: Ia547cf14ea315468b12a4ff5f389ac2d2beceafa
2021-04-22 16:28:30 -07:00
Jon Miranda
c9ad2dd6c7 Add new app close implementation.
- We remove the fling completely
- We set damping to 1 for x/y springs so there is no
  bounciness, and updated the stiffness and bounds to tighten
  up the path to the final location.
- During the animation, we translate all launcher content
  down
- When the x/y springs, and rect animator all finish,
  we use a spring to bounce the launcher content back up

- Added AppCloseConfig so that the entire animation can
  be defined in one location, with getter methods so that
  all the involved parties of the animation can access the
  current value.
- The animations are all defined linearly, and then
  interpolated over using a 3 point curve.

Building behind feature flag as we tune the values.

Bug: 173107751
Test: manual, visual
Change-Id: I83ad0fa2c4234cf30004240d43e191354595adc8
2021-04-22 16:11:11 -04:00
Steven Ng
3242720ce7 Inflate LauncherAppWidgetHostView directly in DragView
Also removes AppWidgetHostViewDrawable

Bug: 183609936
Test: drag-n-drop icons, folders, widgets, shortcuts

Change-Id: I26d8b05b9f9171037f2459fa2389e7e02c8ca6dc
2021-04-20 00:26:07 +01:00
Sunny Goyal
e36664d541 Turn DragView into a FrameLayout
Bug: 183609936
Test: drag-n-drop icons, folders, widgets, shortcuts
Change-Id: I030b36cd59ac6d0ced3263baca13108825ab2296
2021-04-20 00:19:06 +01:00
Adam Cohen
f7ca3b4e3f Update drag and drop visualizations
=> Remove the bitmap-based icon outline
=> Add simple cell based location preview of drop location
=> Round corners of page outlines
=> Get rid of page background for focused page
=> Update colors to use system accent color

Bug: 185163323

Test: manual

Change-Id: Id604c59201536967e25236f305eeeb0aafc9c022
2021-04-15 12:45:24 -07:00
András Klöczl
ea2b30d7fd Merge "Fix app close animation for two panel home" into sc-dev 2021-03-31 09:14:22 +00:00
Andras Kloczl
35d23a62f0 Fix app close animation for two panel home
Change getFirstMatchForAppClose to check all the visible
pages not just the page with the currentPage index.

Test: manual
Bug: 183606840
Change-Id: If5280797f821f7d10f82376aeef5e8eb4d352e2a
2021-03-31 00:09:07 +02:00
Andras Kloczl
3a4ba0bec3 Fix two panel home folder opening display issue
Change the rect calculation logic that is used to
display an opening folder. If multiple panels are
displayed then we calculate the union of the pages.

Test: manual
Bug: 181962118
Change-Id: I504f22890115ceebc16d60929149fe634bf820d0
2021-03-29 22:51:57 +02:00
Sunny Goyal
572aca4ce2 Moving some common functionality to IconLoaderLib
Bug: 183641907
Test: Manual
Change-Id: Icfc7ebb140e4e1678b0715beee2e0e513e707b9e
2021-03-25 10:06:53 -07:00
Zak Cohen
f19300e479 Return empty, not null, a11y node in Workspace
It's not valid to return a null accessbilitynode.

Test: local
Bug: 182529089

Change-Id: I94245fb33128c68e33ce388284f64e5ac3bb23dc
2021-03-18 20:48:45 -07:00
Steven Ng
93c29bff5b Merge "Apply local color extraction during drag-n-drop" into sc-dev 2021-03-18 12:37:19 +00:00
Steven Ng
30dd1d65f6 Apply local color extraction during drag-n-drop
Test: Drag a test widget around and observe local extract color
      is applied.

Bug: b/182282587, b/182816217
Change-Id: If63a9d91ceb2102d5d913bca85997b8be07b1adf
2021-03-17 18:10:51 +00:00
Alex Chau
1e024358ad Merge "Two panel & two page swipe & currentPage fixes" into sc-dev 2021-03-17 13:47:01 +00:00
Andras Kloczl
8e57cce4ee Two panel & two page swipe & currentPage fixes
- Pagespacing set to 0 to have similar design to figma
- Added padding to left side of left panel and right side of right panel to match figma
- getPageScrolls changed to support two page scrolling
- validateNewPage changed so that only even indexed pages can be switched to
- getPageWidthSize added for measurements, it returns half screen width when two panel is active
- onMeasure changed to use getPageWidthSize
- panelCount has been increased from 1 to 2 when two panel is active
- add feature flag for two panel home
- shouldConsumeTouch changed so not only currentpage is checked but currentpage+1 screen as well
- add one more extra check for setDropLayoutForDragObject for currentpage + 2, next to right panel
- using new grid option for two panel home screen

Test: manual
Bug: 174464115
Change-Id: I1bad7eecc67f65fb833608744a5aa5aca65373b4
2021-03-17 12:19:02 +01:00
Steven Ng
f61949803a Merge "Replace DragView bitmap with drawable" into sc-dev 2021-03-16 21:51:07 +00:00
Steven Ng
0226d1ad79 Replace DragView bitmap with drawable
This is a preliminary work for local color extraction. In order to
apply local colors extracted from wallpaper to AppWidgetHostView
during drag, we need to hold a reference of the dragging
AppWidgetHostView.

In this CL, the following changes are made:
1. Instead of using bitmap image directly for icons, folders, shortcuts,
   legacy widget drawable preview, a BitmapDrawable wrapper is
    introduced.
2. Introduce a WidgetHostViewDraggableDrawable which draws
   LauncherAppWidgetHostView directly to canvas. No more bitmap
   generation overhead.
3. Remove drag outline from the drag logic because this will be replaced
   by a new grid color hint UI: https://screenshot.googleplex.com/7jBEVeuxFecFKKT.png

Test: Add: add widgets, shortcuts from widgets tray.
           add icons from all apps.
           create folder.
      Drag: drag existing widgets, shortcuts, folders and icons around

Bug: 182282587
Change-Id: Ia45ff756ea5bb80cf0761f0727a9453d50c204c0
2021-03-16 00:02:38 +00:00
Tony Wickham
9f9787ad76 Merge "Remove insets due to Taskbar, except on workspace elements" into sc-dev 2021-03-15 23:41:55 +00:00
Tony Wickham
145b7fd68c Remove insets due to Taskbar, except on workspace elements
Test: go to all apps, ensure no bottom insets/limited nav bar
protection; go to overview, ensure no extra bottom padding

Bug: 171917176
Change-Id: I09dc589e1cb8d3b673bf2b38e42284557413e011
2021-03-12 16:46:54 -08:00
Pierre Barbier de Reuille
ab33b76dce Launcher changes to support dynamic coloring on static widgets.
Bug: 179783721
Test: By hand using the AppWidgetDynamicColors widget
Change-Id: I27863cac31f2f6c29f5a717ff8d4492325f936fb
2021-03-10 22:04:35 +00:00
Tony Wickham
39938cbc94 Initiate Hotseat drag from long pressing corresponding Taskbar item
When you long press on the taskbar hotseat item, the following happens:
- We start a system drag and drop with an invisible drag shadow
- We create a new DragOptions with the simulatedDndStartPoint set to the
  drag down position, and tell Launcher to use that for the next drag
- We perform a long click on the equivalent Hotseat item in Launcher
- We pass the drag events of that operation to Launcher's DragController

This allows Launcher to handle the entire drag operation, including the
pre-drag (with popup), and taskbar already hides when the drag starts.

Test: Long press items in taskbar hotseat, able to drag them to workspace

Bug: 179886115
Bug: 171917176
Change-Id: I576b80cb1bd0225cdc91cf7689fdee0481265109
2021-03-06 03:39:54 +00:00
Sunny Goyal
befaad269e Merge "Fixing empty page not removed when drag ends" into sc-dev 2021-03-05 06:29:33 +00:00
Sunny Goyal
97c2e513b3 Fixing empty page not removed when drag ends
Bug: 179550470
Test: Verified on device
Change-Id: Ie9b20dfde1a64b385041f6e4d32fe47e3c6e5a7d
2021-03-02 13:00:22 -08:00
Alex Chau
b794ea64c7 Show TaskView as grid in large screens
- Introduced gridProgress to RecentsView/TaskView ofr animating into grid
- Introduced gridProgress dependant translation and scale properties in TaskView
- Animate running task into grid with TaskViewSimulator
- Remove overview actions (for now) but keep clear all button in large screens
- Adjust ClearAllButton translation to acoomodate for grid
- Use screen width +-50% to calculate task visibility
- Use the position where TaskView is on screenEnd as pageScroll
- TODO: Handle separate recents activity

Doc: go/foldables-launcher-overview
Video: http://dr/file/d/107Aydii1LoFCwP63nWG3Twr2PBDE5ZgD/view?resourcekey=0-aUjdnx8ezimS9tmAgao9ag
Test: Test Launchering overview and launching overview from apps with folloiwng combination:
- large / small screen sizes
- portrait / landscape
- thumbnails from different screen sizes / orientations
Bug: 174464863
Fixes: 181509346

Change-Id: I4b691cde774f2e37532b68ba83c6eed399f2332e
2021-03-02 17:10:45 +00:00