Commit Graph

287 Commits

Author SHA1 Message Date
Treehugger Robot
7b01dbd811 Merge "Add seam space for performReorder in MultipageCellLayout" into udc-dev 2023-05-18 23:20:40 +00:00
Sebastian Franco
96c46e7fba Add seam space for performReorder in MultipageCellLayout
In the other method createAreaForResize we add 1 to the cellX
to account for the seam in the Multipace CellLayout but we don't
account for that on performReorder and we need to add a cellWidth

Also, some methods are not running when the seam is added so their
result are wrong. Now all methods are being accounted for.

Fix: 277709417
Test: atest ReorderAlgorithm
Test: atest MulticellReorderAlgorithm
Change-Id: I7a4ca55f7b9cd7cf94481c880fe152e0a3bb3cf3
2023-05-18 14:47:47 -07:00
Charlie Anderson
438d405aab Adding a new Edit Mode LauncherState
- Edit Mode doesn't close after dragging / dropping an app
	- Edit Mode can be entered through options popup menu, Spring Loaded still entered by dragging items
	- Adds new onLeavingState call to launcher states to cleanup changes

Bug: 279590398
Flag: MULTI_SELECT_EDIT_MODE
Test: manually tested the new state with flag on/off

Change-Id: If4550037f9659dcb8cd8b1943388d1ec5d55fa29
2023-05-12 14:54:45 -04:00
Sebastian Franco
45b39b50e5 Adding unit test to ReorderAlgorithm
Adding 100 different test cases for the ReorderAlgorithm.
The test cases are randomly generated using generateRandomTestCase()
the boards are generated once and then written in the file
reorder_algorithm_test_cases. I will leave the code to generate
the boards in the Test even though is not used anymore in case
we need to generate more boards later on.

Also, I found that the ReorderAlgorithm was not deterministic,
meaning that it could generate two different results with the same
inputs (views positions and view being drag positions), because
it was traversing a map whose has was the object id which is
random. So I sort the views before traversing them.

Bug: 229292911
Test: atest ReorderAlgorithmUnitTestCase

Change-Id: I196eb8f1dafcb57d5259969268c458129ae4f46b
2023-05-03 11:22:09 -06:00
fbaron
e74256bba8 Remove unused code for old mult select design
We previously made a few CL's guarded under flags for the multi select feature. We ended up having to halt progress on this, and now that we're starting again, the design is different and we are using a new flag. Here we get rid of the unused code and flags

Bug: 277617038
Test: Verify everything still works normally, everything was guarded under flags that were off so there shouldn't be any changes
Change-Id: I2f57d1f67aa2a8cf83287f6f3df9fa6c46dbf0ab
2023-04-10 14:55:41 -07:00
Sebastián Franco
2a40823a78 Merge "Fixing test that fail when FOLDABLE_SINGLE_PAGE is set to true" into udc-dev 2023-03-21 22:32:42 +00:00
Sebastian Franco
25423867af Fixing test that fail when FOLDABLE_SINGLE_PAGE is set to true
We need to change the result of REQUEST_IS_TWO_PANELS when the
flag is on because now we don't have two panels only 1.

Another of the issues is a rounding error when calling
getUnusedHorizontalSpace().

And lastly updating workspaceToBoards so that it maps the coordinate
of workspace items to their right position.

Bug: 270395274
Test: atest ReorderWidgets
Change-Id: I2620e5bf1ba132f984e00d2a6c21081953d259fd
2023-03-20 17:06:20 +00:00
Tony Wickham
ec6fd6ffb5 Update folder leave-behind color for taskbar
Test: open folder in light theme and dark theme
Fixes: 265828742
Change-Id: Ib544ab85dad16c203917ae02f924650e8a5bbc6f
2023-03-16 18:13:20 +00:00
Sebastián Franco
90ff89e2b9 Merge "Decoupling the reorder logic from the CellLayout view" into tm-qpr-dev 2023-03-07 00:24:33 +00:00
Sebastian Franco
e4c0345747 Decoupling the reorder logic from the CellLayout view
ReorderAlgorithm will now handle all the logic associated with the
reorder. Basically all the logic associated with a reorder in CellLayout
was copy and pasted into ReorderAlgorithm.java.

Test: atest TestReorderAlgorithm
Bug: 229292911
Change-Id: Ie096abc346bf705414e47452a42d1dec5be0a041
2023-03-03 16:57:02 -08:00
Sunny Goyal
82dfc15037 Simplifying code around multiple translation components
Bug: 270759683
Test: Verified on device
Change-Id: I6c758c715828ae25e0e3c60b793cf85d70cb2487
2023-03-02 12:22:03 -08:00
Sebastian Franco
09589326db Simulating a split screen CellLayout using one CellLayout
Test: atest ReorderWidget
Fix: 188081026
Change-Id: I8eda5f77c11dc2625ae1f028d07539c28018fb55
2023-02-07 17:03:22 -08:00
Sunny Goyal
669b71f5b3 Introducing CellPosMapper which allows mapping between UI position
and model position

Test: atest CellPosMapperTest
Bug: 188081026
Change-Id: If5c6b3df5ad240317bb535c675f6ead94084238e
2023-01-30 12:17:09 -08:00
Sebastian Franco
877088e6c3 Change the access of cellX/Y of CellLayoutLayoutParams to private
Bug: 188081026
Test: no op change, should compile
Test: ReorderWidgets
Change-Id: I20367974e5a4cead406e18eb66dafd4d59651b2a
Merged-In: I20367974e5a4cead406e18eb66dafd4d59651b2a
2023-01-13 18:25:10 +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