Commit Graph

274 Commits

Author SHA1 Message Date
Sebastian Franco
a955403ba9 Change the access of cellX/Y of CellLayoutLayoutParams to private
Cherry pick needed for changes on workspace lily

Bug: 188081026
Test: no op change, should compile
Test: ReorderWidgets
Change-Id: I20367974e5a4cead406e18eb66dafd4d59651b2a
2023-01-11 15:25:23 +00:00
Sebastian Franco
5aa71cee20 Clean mPreviousSolution on change of CellLayout target
The previous reorder solution is not peropperly cleaned and
that leads to wrong solution being used. For example when
longpressing an icon, it triggers a drag but the drag never
finishes.

Fix: 261122618
Test: You can no longer overlap a shortcut in the same app icon (see attached bug)
Test: atest ReorderWidget

Change-Id: Iff8651926cc4179561761c7ce0ac5007f13fc9af
2022-12-14 15:20:50 -06:00
Sebastian Franco
2ceb3b5088 Adding screen ID parameter in CellLayoutLayoutParams
Bug: 188081026
Test: launcher compiles, this test doesn't change existing logic only the model
Change-Id: I7bcf6452d5ecb9b50914defc311ad06839220c92
2022-12-02 13:40:34 -08:00
TreeHugger Robot
691c6e511f Merge changes from topic "revert-20479526-revert-20427045-258023561-BPDASTWITO-FBDWZBDEFC" into tm-qpr-dev
* changes:
  Fixing the revert by not continuing the reorder if the solution is null.
  Revert "Revert "Reorder widgets no longer overlaps when no space..."
2022-11-22 21:18:42 +00:00
Sebastian Franco
9c74327e13 Fixing the revert by not continuing the reorder if the solution is null.
Fix: 258023561
Bug: 259234533
Test: atest testAddDeleteShortcutOnHotseat
Change-Id: I63a2abf8a80e16fb45f4bbb3b2de413ef77b5e0c
2022-11-15 15:13:23 -08:00
Sebastián Franco
f9a6ac241a Revert "Revert "Reorder widgets no longer overlaps when no space..."
Revert "Revert "Reorder widgets no longer overlaps when no space..."

Revert submission 20479526-revert-20427045-258023561-BPDASTWITO

Reason for revert: Fix the issue that caused the first revert.
Reverted Changes:
Icecfd1d34:Revert "Reorder widgets no longer overlaps when no...
I4cc552588:Revert "Reorder widgets no longer overlaps when no...

Change-Id: I47c4cde42c19f50e2834660d843a8e2ae571c03c
2022-11-15 22:56:41 +00:00
Sam Dubey
3d24f6735a Merge "Revert "Reorder widgets no longer overlaps when no space is avai..."" into tm-qpr-dev 2022-11-15 14:28:11 +00:00
Sam Dubey
3dad4fec9f Revert "Reorder widgets no longer overlaps when no space is avai..."
Revert "Reorder widgets no longer overlaps when no space is avai..."

Revert submission 20427045-258023561

Reason for revert: Likely causing NPE while running launcher shortcut tests (Part of DM+Platinum monitor rotation. The revert won't be submitted if proven otherwise)

Bug: 259234533
Reverted Changes:
Ie599f7cb7:Reorder widgets no longer overlaps when no space i...
I04b262ecc:Reorder widgets no longer overlaps when no space i...

Change-Id: I4cc552588c8099356bc3f05c4c63d17a524f2a24
2022-11-15 13:24:19 +00:00
TreeHugger Robot
e2334d76fe Merge "Reorder widgets no longer overlaps when no space is available" into tm-qpr-dev 2022-11-15 09:53:02 +00:00
Sebastian Franco
893615f241 Reorder widgets no longer overlaps when no space is available
In the previous refactor I got confused between findNearestVacantArea
and findNearestArea thinking the later did the former. So it ignored the occupied spaces and treat it as a solution.

Changed the names to prevent further confusion.

Fix: 258023561
Test: manual, need to add this case to ReorderWidgets
Change-Id: I04b262ecce168d5c93a9d66ef62d5b0e148e38b6
2022-11-08 19:02:15 +00:00
Alex Chau
1feadf7d81 Merge "Improve spaces for folders" into tm-qpr-dev 2022-11-08 16:51:50 +00:00
Thales Lima
b35faed6e7 Improve spaces for folders
Bug: 214582832
Test: DeviceProfileTest
Change-Id: I7c5cae0792d51baf111d0aec46be302ac6ca9994
2022-11-07 18:23:48 +00:00
Sebastián Franco
fda1f3c379 Merge "Making code more readable by removing global variable used for optimizations" into tm-qpr-dev 2022-11-04 17:46:22 +00:00
Sebastián Franco
c3cefebab4 Merge "Ensure that the reorder preview and what gets submited uses the same solution." into tm-qpr-dev 2022-11-04 17:45:28 +00:00
Sebastian Franco
5d990eedfd Ensure that the reorder preview and what gets submited uses the same solution.
Design doc: https://docs.google.com/document/d/1RsId9OFGgkcImkkmDwWZBBvITWnGlxKVqniE3cimkqY/edit#heading=h.xzptrog8pyxf

As can be seen in the diagram in b/256770363 on every reorder the
first call in the process is MODE_SHOW_REORDER_HINT so if we make
sure that only then a solution is calculated and we reuse that
solution in the rest of the calls in the same reorder then we would
have more consistency and the animation will always be the same and
the logic state.

Fix: 256770363
Bug: 188081026
Test: atest ReorderWidgets
Change-Id: I93a1d09f5b8cbfbc461043ee3fc41b1cab294fed
2022-11-03 14:11:01 -07:00
Sebastian Franco
4a92267d1d Making code more readable by removing global variable used for optimizations
Using the stack was more efficient because it prevented the creation
of new rectangles but it makes the code harder to read and prone to
bugs if the global state of the stack of rectangles gets corrupted
in any way.

When this optimization was written in 2008 it was necessary but now I
don't think it would have a big impact. The stack size is on average
of 30 and the rectangles are only created when doing the reorder which
runs about once per second if the user moves the finger too quickly.

Bug: 188081026
Test: atest ReorderWidgets
Change-Id: I35d8ee8d92f01035e72fe5763a7de47f4b6a73de
2022-11-02 22:10:14 +00:00
Sebastián Franco
ef24d5954c Merge "Return the right radius to start reorder when dragging a Widget" into tm-qpr-dev 2022-11-02 21:19:44 +00:00
Sebastian Franco
9cab1c3ece No code changes, this cl only reorganizes the functions
This is done such that future cls are easier to visualize.

Bug: 188081026
Test: atest ReorderWidgets
Change-Id: I749d21b517dada97887d5b5e7cb5e2ac644d0030
2022-11-01 18:24:43 +00:00
Sebastian Franco
c8392ea881 Return the right radius to start reorder when dragging a Widget
Currently the radius is only one cell but in the case of a widget
we want the radius of the whole widget.

Fix: 255421400
Test: this case only happens when dagging comming from outside of the cell layuot in the corners dragging a widget
Change-Id: I3fe294d18283dbecb27df1a2d4748dd44db9b956
2022-10-31 10:20:53 -07:00
Sebastian Franco
53a15a4b1f Decoupling finding the solution and animation of a reorder in CellLayout
Adding new functions to CellLayout, two of them return a solution
(calculateReorder, getSimpleReorder) and the other one takes a
solution and animates that solution (void performReorder) and it can
either submit the solution or just show it for a preview.

Right now this two things are done under the same function:
int[] performReorder. The need to separate this two functions is
because to add this functionality b/188081026 which needs to find
soluion without animation and animation solutions that can be
calculated in another place.

Bug: 188081026
Test: atest ReorderWidgets
Change-Id: Ib519d4346f58f9b55aff5008cd3ccbcfe8443d2d
2022-10-28 11:55:50 -07:00
Federico Baron
a56f08e677 Set smartspace to 30% visibility on workspace edit for home gardening
Here we set the smartspace to have 30% visibility to follow the guidelines set by https://docs.google.com/presentation/d/1FOmmCdmGmSMR77_901IOMbvbPVxPmjaAdxZjy-D9tw0/edit#slide=id.g159289e55db_0_229

Bug: 251259222
Test: Enter drag mode in workspace with SHOW_HOME_GARDENING flag on to see the changes
Change-Id: Ia2ef4f1a49549fef9f8fbea7c007db8b81972f71
2022-10-21 13:00:58 -07:00
Federico Baron
1028a726ef Get rid of spring loaded mode for home gardening design
For the new home gardening mode, we plan on not having a spring loaded mode where the overlay shrinks, so when we have the flag for home gardening on, we won't be having the workspace have the green overlay and the icons shrink

Bug: 251259222
Test: Hold on an icon in workspace to enter edit workspace mode, notice how we no longer shrink the workspace
Change-Id: Ibf1c38eecc117a838eca20a860d47c355955b513
2022-10-18 13:49:37 -07:00
Sebastian Franco
d468299c0f Moving the class LayoutParams to a file outside CellLayout
I'm moving the LayoutParams to another file to start the decoupling
of the Reorder outside of the CellLayout.

Also, I change the name from LayoutParams to LauncherLayoutParams to prevent confusion with ViewGroup.LayoutParams making it explicit that this are different LayoutParams.

Bug: 188081026
Test: atest ReorderWidget
Change-Id: I92251c5540ffcf5ece7b933e6f6c836eb825c997
2022-10-12 16:14:42 +00:00
Sebastian Franco
6e1024e161 Account for span greater than 1 in getReorderRadius
Fix: 239963678
Test: Making sure the reorder preview is being drawn when moving a widget
Test: atest ReorderWidgets
Change-Id: Id32919821ac9177b3428261354d361c52b8f9e2d
2022-07-29 13:47:33 -07:00
Sebastian Franco
b57c0b2762 Fixing findNearestArea to account for the padding.
The function findNearestArea calculates the corner of the
cell but in that calculation it doesn't account for the padding
in the cells.

Also, change ignoreOccupied because the name says one thing and
the code does the oposite so I change all true calls for false
calls and change the if to !ignoreOccupied so the description of
the parameter match the behaviour of the method.

Also, removing unused method.

Fix: 236134208
Fix: 236129504
Test: visualizing the components of findNearestArea in ag/19248816.
Change-Id: Iac50fbc76b4fa2acda21894ecb976ba612d468fe
2022-07-13 15:38:00 -07:00
Sebastian Franco
930531f669 Make Talkback anounce which page is the icon being move on.
Adding a third argument for the talkback string.

Fix: 230593493
Test: Move an item using Talkback and it should mention the row,
column and page where you can drop the item.

Change-Id: Id3d4435e9ef3348278643e6e2a1cd1e8bf5157b7
2022-06-22 17:17:38 -07:00
Alex Chau
51da219869 Fix taskbar icon flicker and jump when transforming to hotseat
- Apply additional translation on TaskbarView to account for difference between taskbar icon to bottom spacing compared to hotseat icon to bottom spacing
- Call updateIconAlignment outside of synchronizeNextDraw's then block, which get run after the synchronization

Bug: 204850744
Test: manual
Change-Id: Id65842f506eb342105082649446eb694cd5c33a4
2022-05-23 14:33:34 +01:00
Sebastian Franco
f153d917dd Adding support for LauncherAppWidgetHostView in CellLayout
With the introduction of LauncherAppWidgetHostView, CellLayout
no longer reorder correctly when dragging a widget.

Fix: 221495448
Test: When dragging a widget and all spaces are occupied, other icons
should move to the place the widget being dragged used to occupy.

Change-Id: I59ab21eb2717b56a216900049bb4546504e773ba
2022-04-28 16:23:41 +00:00
Shikha Malhotra
f78da1bae3 Review comments followup
These are review comments followup from ag/17399997

Bug: b/218187058
Test: manually test thet Launcher3 features work correctly
Change-Id: I9865a37c1ed663370dc28e7678994f3d961e3cd1
2022-04-12 14:33:07 +00:00
Pat Manning
52307a4604 Adjust grid cell visualizations.
This is a partial revert of ag/17540098

Bug: 202971709
Test: manual
Change-Id: Ia6f863701c169709053980766337b3caae6fba76
2022-04-06 13:07:08 +01:00
Pat Manning
e372366bb3 Revert "Adjust edit state drop targets, workspace scaling, and m..."
Test: manual

Revert submission 17004675-edit-state

Reason for revert: b/226274309
Reverted Changes:
Ib50509b6f:Adjust edit state drop targets per device type and...
Id1817cd3c:Adjust edit state drop targets, workspace scaling,...

Change-Id: I22863d7735f49f6a040a17cf56cc66f20a3e0986
2022-03-28 08:24:54 -04:00
Thales Lima
f49dce6961 Merge "Reset the size of hotseat cells" into tm-dev 2022-03-22 10:06:22 +00:00
Pat Manning
1acf2b18af Adjust edit state drop targets, workspace scaling, and margins per device type and orientation.
Bug: 202971709
Test: manual
Change-Id: Id1817cd3c7e7bfa5b0aa8aa20565b791ad871f64
2022-03-18 17:43:28 +00:00
Thales Lima
8cd020bb1d Reset the size of hotseat cells
When resetting the hotseat layout, the size of cells also can be changed based on changes in DeviceProfile. In this case, the border size changes when rotating the device.

Fixes 216071526
Test: manual and HSV

Change-Id: Idf7b7972e7be347a991cad1cb8ee8cf95cbc4a87
2022-03-16 17:49:40 +00:00
Andras Kloczl
2dacbee028 Fix incorrect accessibility announcement on two panel home
- Divide total pages by panelCount if two panel is active
- Increment target column when moving an item to right panel

Test: manual
Bug: 200009004
Change-Id: Ia8d2d760dc5e8b413e5b1150c049f7fa3ec26513
2022-02-23 22:35:12 +00:00
Thales Lima
dd027348dd create 6x5 scalable grid for tablets
Create more attributes for landscape and fix the space between icons in the hotseat. The dimensions are correct but some size might differ from mocks because of device scaling, qsb position and insets not finalized.

Bug: 210118169
Test: visual, using HSV and Window
Change-Id: Ie505923dce2e30133eb1e5c9c83c33a2895147f2
2022-01-07 12:54:37 +00:00
Tony Wickham
1278490ac0 Update reorder and folder creation radii
- Before, dragging anywhere in the cell (including space between cells) would trigger a reorder. Now, we compute the radius to the closest cell edge
- For creating folders on icons, we split the difference between the reorder circle (above) and the icon size

Test: enable DEBUG_VISUALIZE_OCCUPIED and manually drag to ensure works as described above
Bug: 204406063
Change-Id: I368714634ed42a930fd16849f2bde1589df1aa63
2021-11-08 12:04:30 -08:00
Tony Wickham
3cfa5edc93 Fix misaligned folder creation drag over target
Previously, the folder creation distance was based on the center of the cell, rather than the *visual* center, i.e. around the icon. Updated to use existing getWorkspaceVisualDragBounds() to handle this.

Test: with DEBUG_VISUALIZE_OCCUPIED=true, ensure green circles are centered around the app icons; manually drag and drop to check the drawn regions are correct
Bug: 204406063
Change-Id: I691a5cbbfc18c88436b88b7bda42f7920b9a5750
2021-11-04 13:40:05 -07:00
Tony Wickham
0ac045fe23 Update CellLayout.DEBUG_VISUALIZE_OCCUPIED to include drag over targets
Instead of just drawing the occupied cells in red, now we draw the occupied cells based on drag over regions:
- Dragging over the red regions will reorder the cell
- Dragging over the green regions will create/add to a folder

Test: visual with internal flag on
Bug: 204406063
Change-Id: I62105c1c1a1101b6cd6f9fd222980d03ba6d8b84
2021-11-04 13:27:56 -07:00
Thales Lima
78d00adcbe launcher: create more space options
The grid doesn't have a constant space between cells anymore, so we need
new attributes for the different spaces in different situations.

Bug: 191879424
Test: checking cell size and extra space in dumpsys
Change-Id: I4b6aae5b3fea281490c00cd13d0cd3a25372f21b
2021-10-05 12:26:05 +01:00
Sunny Goyal
69a8eecdc9 Simplifying color extraction registration logic
> Calulating correct location irrespective of transient
  state (scale/translation)
> Removing extraction pause/resume logic
> Simplifying location calculation and registration (only use one location instead of a list)

Bug: 194732483
Test: Manual
Change-Id: I255d83761bff5e09c9fb0a5e398d0be0c1d0956f
2021-07-28 15:43:13 -07:00
Adam Cohen
2a0516f6cc Fix widget drop preview outline on 4x5 grids am: ed82e0daef
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15351419

Change-Id: I37f0cde316ac0a4c7b793ad25b23d5208ca90b65
2021-07-22 22:55:49 +00:00
Adam Cohen
ed82e0daef Fix widget drop preview outline on 4x5 grids
=> We were not account for mBorderSpacing in the outline calculation
=> This was fine in most cases as this value is 0, but 4x5 appears to be the exception

Bug: 194227752

Test: manual, see video in bug.
Change-Id: Ib590bc142a0f65e75f92ee057f8b4f4b0f81521b
2021-07-22 12:31:21 -07:00
Sunny Goyal
711c596c86 Binding Taskbar directly from Launcher model
This allows taskbar to be loaded even in case of 3P Launchers
and removes dependency on LauncherActivity lifecycle

Bug: 187353581
Bug: 188788621
Test: Manual
Change-Id: I5a0988e0697b41677d4c58f0213aef14ec0c0972
2021-07-15 12:43:11 -07:00
TreeHugger Robot
1491ec31c5 Merge "Update widget manipulation colors." into sc-dev 2021-06-25 15:18:45 +00:00
Yogisha Dixit
c0ac1dda74 Update widget manipulation colors.
Spec:
* Resize frame: https://docs.google.com/presentation/d/1UxdDh8EFhPbdRWRwzjbpgL-j02ew4Ew3eG3XBCeoYdo/edit#slide=id.OeO4S0j
* Drop target bar: https://docs.google.com/presentation/d/1UxdDh8EFhPbdRWRwzjbpgL-j02ew4Ew3eG3XBCeoYdo/edit#slide=id.vXfwHn8

Test: manual
Bug: 187910396
Change-Id: I6fd433796970c428841ee96e45ee4fca1ded3665
Merged-In: I6fd433796970c428841ee96e45ee4fca1ded3665
2021-06-25 08:43:29 +00:00
Jon Miranda
fa1e14c4b8 Polish folder icon bugs.
- Fix bug where folders are misaligned.
- Fix bug when closing on 2nd page of large folder.

Bug: 184822585
Test: drag folder originally in hotseat to workspace, vice versa
      test on grid where isScalable=true and isScalable=false

Change-Id: I08a79b8d280df3e3974baaa07e80db6bc4165e58
2021-06-22 11:12:47 -07:00
Pierre Barbier de Reuille
1b8bbb6c40 Correct size of AppWidget for color extraction.
Correct the size of the App Widget: first, compute the size when the
widget is positioned (it wasn't done), then do not apply the
transformation when computing the size of the widget when drawn.

Note: Somehow, there is a shift by 1 on the position on the x axis, both
in landscape and portrait. So I added a +1 to get the exact same values.
If not, we have a risk of getting different colors.

Fix: 188759989
Bug: 187907544
Test: Added logs and moved a widget by hand, check the actual
coordinates with hsv.

Change-Id: Ia3bd5b3e3ea9a3ef75f8cdf466a9800786646a94
2021-05-20 21:02:30 +01:00
Jon Miranda
88b7f6a0d5 Move color extraction utils to extractor class so each instance can
have its own set of temp variables.

- Pass in float[] param to not create new obj in each frame
  for dragging widget case.

Bug: 175329686
Bug: 187019711
Test: manual, verify
Change-Id: I4350fb7e66a80c73def5659fb41abc14d357e667
2021-05-04 09:00:01 -07:00
Jonathan Miranda
21930da9a2 Revert "Revert "Use color extraction for arrow popup.""
This reverts commit 17fda29bf3.

Reason for revert: Fixing the memory leak

Leak was detected in caused launcher tapl tests to fail.
For instructions on how to debug leaks, see go/launcher-testing.
Using AS memory profiler, the color extractor class is holding
onto a reference to launcher that has already been destroyed.
The fix is to set the listener to null when view is closed.

Bug: 175329686
Test: run profiler in AS, open and close popups, and verify no leaks

Change-Id: I2d4a87f0481cbc88f3587dce91278e85ca113545
2021-05-04 08:53:58 -07:00