Commit Graph

72 Commits

Author SHA1 Message Date
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
Sihua Ma
0593a0d3ec Created LauncherWidgetHolder as a wrapper for LauncherAppWidgetHost
The wrapper class is created for further changes that will run the wrapped host in the background.

Test: N/A
Bug: 235358918
Change-Id: I9bd6fc2749c5d4a4d3391fb75d0c3ff1e13d17bf
2022-10-26 10:57:13 -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
Sunny Goyal
cd89ca36b6 Fixing Launcher crash if activity restarts while resixing widget
When activity restarts, the widgetView gets onDetachFromWindow first
which inturn removes the AppWidgetResizeFrame from drawLayer while
the dispatchAttachToWindow was still in progress in DragLayer

Bug: 238416508
Test: Verified no crash after the change
Change-Id: I6359840c9fb3ae2719056845818620af19d3c94d
2022-07-13 12:22:01 -07: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
TreeHugger Robot
d4df41b78f Merge "Bugfix where the widget handles appear even when you can't resize it." into sc-v2-dev 2021-10-21 20:46:37 +00:00
Sebastian Franco
4067f5d4ae Bugfix where the widget handles appear even when you can't resize it.
To fix it I added the following logic condition: if the minimum size of
the widget (`mMinVSpan` vertically) is equal to the maximum size of the
widget (`mMaxVSpan` vertically), then you can't change the size and the
handles shouldn't appear, I did this for both the horizontal handles as
well as the vertical handles.

Fix: 202004006
Change-Id: Ide05231f5712a736129ac6cb2fee358f7c70e371
Test: Manully veryfied.
2021-10-21 17:32:31 +00:00
Yogisha Dixit
7b1d25b251 Fix bug with resize frame in Launcher3.
Also updated the tests to check that the resize frame is shown.

Bug: 192655785
Test: AddWidgetTest, AddConfigWidgetTest, manual
Change-Id: Id348f39cec1bebc8ec9ea9f3068f4bda2159eac4
2021-10-20 19:03:14 +01: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
Steven Ng
4b346108d1 Add an animation for invalid widget resizing in 2 panel UI
Test: manual
Fix: 197509872
Change-Id: Ibcfae107e7f4b3bfbc562d4a6436f4b9237db122
2021-09-20 15:33:23 +01:00
Yogisha Dixit
037a5362d8 Show resize frame when widget is added.
I referenced the code in Workspace.java that updates the widget view's
layout params before showing the resize frame.

Test: manual, AddWidgetTest and AddConfigWidgetTest tapl tests
Bug: 183437963
Change-Id: I6655917878fa22d6084b4bf39fc0661e7278d6f9
2021-06-29 18:25:38 +01:00
Yogisha Dixit
ad68318048 Don't show resize handle if widget cannot be resized.
Test: manual
Bug: 190015493
Change-Id: Ibb0cc347103b8d01d30a19925f929617426e4889
2021-06-29 09:08:09 +01:00
Alina Zaidi
dca47432fc Flip ArrowTipView when it goes beyond screen height.
Bug: 185354491
Test: Manually tested tips in widget picker, all apps, and
reconfigurable widgets tip.

Change-Id: I5d1c9e4b8bc3ae89834bc198016ffa409a2b28ad
2021-06-10 15:43:30 +01:00
Alina Zaidi
ecdf6575ec Add more education tips for widgets. (3/3)
Show tip on reconfigurable widget in launcher.

Bug: 185354491
Test: Manually tested tips in widget picker, all apps, and
reconfigurable widgets tip.

Change-Id: I08154c944285cac6a21c3ef4aafd878bbbccf44b
2021-06-10 14:23:47 +01: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
Yogisha Dixit
4ff5ee3a8f Add new log events for widgets.
Design doc: go/widgets-logging

Bug: 185778648
Test: manual
Change-Id: Ia3c6edb87766a33e77865e9461e7101a1df864c1
2021-06-04 14:52:37 +01:00
Steven Ng
f8af753b6a Merge "Fix LayoutParams cast exception in drag-n-drop" into sc-dev 2021-05-05 18:07:32 +00:00
Steven Ng
79d76b5041 Fix LayoutParams cast exception in drag-n-drop
Test: Pick up a widget from home screen. Then drop it and immediately
      pick it up again before the resize frame is dismissed. No crash
      is observed.
Bug: 186663184
Change-Id: Ia40676fbbf5d6dc2e2043aa7acd6ae00f1fa4179
2021-05-04 18:46:51 +01: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
Yogisha Dixit
73c8a366a8 Add a button for reconfiguring widgets.
Test: manual
Bug: 183316993
Change-Id: I17bec121e3d07d65979c2b92c285e487a7d64d65
2021-03-24 13:34:29 +00:00
Pierre Barbier de Reuille
452df2d5bb Update the resize frame to use the forced radius.
When forcing the rounded corners, the radius may be smaller than the
default one. When this happens, we should change how the frame is drawn
to only use that reduced radius, or this looks weird.

Bug: 183097166
Test: Manual tests with top 1P App Widgets
Change-Id: I6ce232515ce14059e1168e16735719ea2370132c
2021-03-23 20:57:33 +00:00
Yogisha Dixit
471922c5ac Do not allow widget to be resized beyond max size.
Test: manual
Bug: 179807199
Change-Id: I38e108a8db2c5f06c0922972efa334e3b2864046
2021-03-22 11:14:48 +00:00
Yogisha Dixit
f9954cc4cc Fix bug with resize frame disappearing.
Currently, if you resize the widget to the top, bottom or right, the
resize frame disappears. This is because the AppWidgetResizeFrame code
relies on the indices of the child elements to find the drag handles.

I updated the code to instead use IDs since that is more robust.

Test: manual
Bug: 182305670
Change-Id: Iaa9d32c9190fb579101914f03d57bb48dcecb88d
2021-03-16 21:31:46 +00:00
Sunny Goyal
de18647f91 Merge "Removing unused keyboard handling code" into sc-dev 2021-03-10 00:13:27 +00:00
Pierre Barbier de Reuille
18d159a250 Correct Launcher3 for new sizes in App Widgets.
This follow recommendations from the API council review.

Also removes two public functions introduced recently by
http://ag/13473552 and are not needed anymore.

Bug: 181611658
Test: Manual testing with local widget.
Change-Id: I8d0c90a80a0d45981bd5d16e69cd86639d5ec7d8
2021-03-05 11:44:11 +00:00
Jonathan Miranda
a9bb9394a5 Merge "More grid changes, closer to final specs." into sc-dev 2021-03-02 19:19:08 +00:00
Yogisha Dixit
741fae9ea2 Move widget files into widget folder + add tests.
I will use the newly created LauncherAppWidgetProviderInfoTest in a follow-up CL to add tests for the newly added widget sizing APIs.

Test: Automatic: Ran all robolectric tests in launcher3,
      Manual: Added a widget, edited the widget, removed the widget
Bug: 179807199
Change-Id: I540b2dbe284c6eb5aa2466a1d13a9581ee59425b
2021-03-01 13:59:52 +00:00
Jon Miranda
e126d72fa8 More grid changes, closer to final specs.
* Added isScalable, minCellWidth, minCellHeight, and borderSpacing attrs

When isScalable is true, we use set workspace cell values to
minCellWidth/minCellHeight and then scale the cell values to
fit the available space. This allows us to have consistent
aspect ratios when two devices match the display/grid options.

This is different from the dynamic grid, which calculates
cell values based on iconSize/textSize/etc and then allows
the cell width to be as wide as space allows.

I adjusted some variables so that they will auto adjust
based on another value, indepenent from whether the
grid isScalable or not. An example of this is the folder
label text, where it's always set to be 1.14x of whatever
the workspace icon text size is. This is so we don't need
to add a bunch of more variables to DisplayOption/GridOption.

Bug: 175329686
Test: - switching between device profiles,
      - testing folder open/close
      - testing in multiwindow
      - testing in landscape
Change-Id: Ia469ae0d65b518469ef264b726db46f4a3210056
2021-02-25 17:34:56 -05:00
Pierre Barbier de Reuille
b2526feb24 Launcher changes for go/widget-size-specification
Makes sure the launcher:

1 - Send the list of actual sizes the widget in all situations.
2 - Gives the current size to the framework on inflation.

Also needed to guard the new border changes introduced in
http://ag/13532637 with the corresponding flag.

Change-Id: I2a33e9501b921f2fc393684e8ce91ee077626bf7
Test: By hand using a local widget.
Bug: 179025145
2021-02-24 20:40:41 +00:00
Jon Miranda
228877d37c Add border spacing and fixed cell height to grid.
- Border spacing is the spacing between the cells.
- Workspace cell height is now fixed, and we allocate
  all the "extra" space to three different variable height
  areas.

* Built behind ENABLE_FOUR_COLUMNS flag because it hinders the
default grid.

Bug: 175329686
Test: - set border spacing to 0 and confirm matches prior layout
      - test drag and drop still worked
      - test reordering
      - test widgets
      - test folders
      - test multiwindow

Change-Id: Ic6f3dff577d28ff214bda4b0a787ec7fd08c108b
2021-02-10 17:22:37 -05:00
Sunny Goyal
11b5f6053f Removing unused keyboard handling code
Bug: 178781566
Test: Presubmit
Change-Id: I997a7980f4ae2cef1e599ca2cadffc56df5f296e
2021-01-29 17:02:34 -08:00
Samuel Fufa
37432444fc Initial setup for widgets in Search
LiveSearchManager creates AppWidgetHost when user starts a new search session and destroys it when user returns to home. In addition, it also manages the creation and caching of PlaceholderSearchWidget which can be used to create AppWidgetHostViews.
Bug: 168321831
Test: Manual

Change-Id: I06a893028e55aa6e0702a4f1cd7a2edbb1f61671
2020-11-07 10:07:33 -06:00
Hyunyoung Song
6b670d62df Good riddance UserEventDispatcher [1/n]
Bug: 165675920
Change-Id: I237ed4243e1724b3c370c5660673bb3966bf4811
2020-08-24 21:19:09 -07:00
Sunny Goyal
e396abf502 Moving model data structures to a separate file
Change-Id: I77ad7a5219e72d2e0d6c1803de2ac3ed6a65a8f7
2020-04-09 13:20:39 -07:00
Sunny Goyal
73b5a27b14 Updating some non-final static objects
Updating various static objects to use a standard pattern so that
it is easier to track and cleanup those objects

Bug: 141376165
Change-Id: Ia539cbfa338d544dddad771c5027b6748762768b
2019-12-11 13:22:58 -08:00
Tony Wickham
a5fb60aae8 Add system gesture exclusion rects for widget resize handles
Change-Id: I67cae5d4cb27e4db36811f62480e7ab89e79bf49
2019-04-03 21:07:13 +00:00
Sunny Goyal
55bdeed7bb Removing various reflection based animations, to allow for better proguarding
Change-Id: If9df24ea4170e8a3d336057d1c3dc800934fc1ac
2018-09-21 18:21:04 +00:00
Sunny Goyal
f0b6db7fa8 Removing static launcher activity dependency from FirstFrameAnimationHelper
Static dependency does not work in the presence of multiple activities and
when the main activity is not Launcher (eg in fallback recents). Instead
creating FirstFrameAnimatorHelper on demand for individual animations.

Change-Id: I17bb69bbaaca92f0db994fb56fd784302c57d543
2018-08-13 16:10:18 -07:00
Sunny Goyal
849c6a2b18 Removing Launcher activity dependency on various animations
(This cl reverts change-Id: I455edcd17bda83ab51c2c04fa40e66097a4d6975)

Various animations were marked for cancellation when launcher activity is
destroyed. This this does not work with multiple activities (Launcher,
fallback recents, shortcut confirmation). Also since launcher activity
handles configuration changes, the activity is not destroyed often.

Instead associating a target with various animations which automatically
cancels the animations when that target goes away.

Change-Id: I64cd095a28075561a9e20c9dcdeb9f90c18e1047
2018-08-10 13:31:46 -07:00
Sunny Goyal
29947f0b53 No more waiting around for resume
Apply model updates as son as they arrive instead of waiting for onResume.
Various workspace items do not use any configuration dependent resources.
For Widgets, we wait until the host starts lietening before inflating the actual view.

Change-Id: Icb2f5e5940c1ce6c27062ccd34eff87e80af5ab1
2017-12-19 12:50:17 -08:00
Sunny Goyal
3792096688 Allowing the widgetBottomSheet to be dragged
even when the touch is started from outside the panel

Removing various instanceOf checks in onNewIntent and onBackPress
and moving all the corresponding logging in the FloatingView
This simplifies handling of panel specific log and avoids
missing a particular panel type in the if-else statement.

Bug: 64751884
Bug: 64751923
Change-Id: I98f5aae18560a64be73c9efcf495479740d49a00
2017-10-02 16:18:52 -07:00
Sunny Goyal
952e63d006 Fixing custom widgets support:
> Moving the definitions to xml so that it is easier to override in derivative projects
> Fixing verious bind and save logic for custom widgets
> Adding feature flag to easily disable custom widgets

Change-Id: I0e278bc7dd415713029364060ef10842da990be9
2017-09-13 14:04:35 -07:00
Sunny Goyal
988ad27be4 Applying the widget resize changes even when the activity is destroyed
in the middle of the resize interaction.

Bug: 64759853
Change-Id: I65ab7df0426f36fe1121bf055e38fc722822b0f4
2017-08-23 21:19:42 +00:00
Sunny Goyal
87f784c285 Removing static Context access using LauncherAppState
> This ensures that LauncherAppState is only accessed in the presence of
a valid context

Bug: 33032833
Change-Id: I955e5cb022f8bd6374681ae6c0720a2666d5b750
2017-01-11 12:52:03 -08:00
Jonathan Miranda
e09bacc1ef Merge "Fixed mw bug where resize frame is off when resizing." into ub-launcher3-master 2017-01-09 19:48:01 +00:00
Jon Miranda
9f33cb2ce2 Bind the out IntRange using its start and end values.
In applyDeltaAndBound, we add the current IntRange values
+ delta param to the outbound IntRange -- but then we only
bind based on the current IntRange values, so the out IntRange
values can end be out of bounds.

Change-Id: Ibbaae8c2c2734107d1fd7ce8a59a4c66d83068ad
2017-01-03 09:38:11 -08:00
Jon Miranda
097a725bb8 Fixed mw bug where resize frame is off when resizing.
When a widget resizes in multi-window mode (ie. user is dragging
the resize frame), the frame is misaligned until the user lets go.
This is because the translation value to center fit the resized
widget is not taken into consideration.

Bug: 32176631
Change-Id: I6f9ee7be12d3266f021796576c771f86f6120246
2016-12-29 17:09:10 -08:00
Jon Miranda
2126691ce2 Fix widget reorder animations in multi-window mode.
The original animation assumed that the views are not
translated and not scaled. In multi-window mode this
assumption is no longer valid, because app widgets are
scaled and translated to fit center within their cells.

Bug: 32176631
Change-Id: Id60c793730d982277c9d91860e9fb0e6a0df7d38
2016-12-20 09:31:47 -08:00
Jon Miranda
26e4d17a73 Resize widget frame now wraps the scaled widget view.
Previous implementation had space between the frame and
the widget ie. letterboxing.

Bug: 32176631
Change-Id: Ie50279f4edb94812120dea492aefa4f18218162f
2016-12-13 08:53:57 -08:00
Jon Miranda
7ae64ffbe1 Scale widgets in multi-window mode.
To keep this CL small and focused, I'm going to create
a separate CL that handles the scaling for the widget in
drag and drop mode.

Bug: 32176631
Change-Id: Id6557d070edb664aa1f4851de7abf494cf8a0677
2016-11-23 10:32:42 -08:00