Commit Graph

543 Commits

Author SHA1 Message Date
Sunny Goyal
5d5085c5c3 Fixing widget not laid-out properly in preview
Bug: 185306338
Test: Manual
Change-Id: Ib1ec8a53e4701f6813813b86bf481b837127a909
2021-06-16 15:24:16 -07:00
Stevie Kideckel
358411a96a Merge "Use drawable states for list positions instead of swapping drawables" into sc-dev 2021-06-16 09:34:21 +00:00
Alina Zaidi
b5459c9ba5 Merge "Update bottom widget picker and pin widget dialog layout in landscape mode." into sc-dev 2021-06-15 17:23:02 +00:00
Stevie Kideckel
803927bdae Use drawable states for list positions instead of swapping drawables
Replacing drawables interrupts touch feedback of ripples. Implementing
custom state lists allows altering the corner radius without cutting off
ripples and also means we reduce unnecessary object creation.

Fix: 190467676
Test: locally
Change-Id: I10eec042aae57d278f8254327d42df945767c7ac
2021-06-15 16:32:36 +00:00
Alina Zaidi
dfa6aa828c Update bottom widget picker and pin widget dialog layout in landscape mode.
Bug: 189726613
Test: Manually tested
Change-Id: I048740f949571423ab53bbb01e7128d9981b1ce7
2021-06-15 14:27:57 +01:00
Stevie Kideckel
d541300f0e Merge "Use LayoutManager.onLayoutCompleted as a signal that content has changed" into sc-dev 2021-06-14 09:18:06 +00:00
Stevie Kideckel
2f0c5ac3c8 Merge "Account for header margin depending on which header is selected" into sc-dev 2021-06-12 21:47:01 +00:00
Cyrus Boadway
f2ec20325b Merge "Add activity-start/return animation to widget configuration" into sc-dev 2021-06-12 17:15:11 +00:00
Stevie Kideckel
2dab912b95 Use LayoutManager.onLayoutCompleted as a signal that content has changed
onChildAttachedToWindow is called before the layout manager is finished
processing the layout, so incorrect measurements / intermediate
animation states can be present.

onLayoutCompleted occurs after each full layout calculation, including
measuring multiple views or animating, and is a better signal to use.

Fix: 190391539
Test: verified locally with search use case and other expand collapse
cases

Change-Id: If01caf33c6c3371636895e1361d80de536363239
2021-06-11 16:40:49 +00:00
Cyrus Boadway
2668e731a0 Add activity-start/return animation to widget configuration
When launching the configuration activity for a widget, use the
activity transition animation.

Test: manual
Bug: 190487998

Change-Id: Ife84e86eec74f81fecddce07c833356a7962fd4b
2021-06-10 21:37:04 +00:00
Alina Zaidi
1fbf9200f1 Merge changes I5d1c9e4b,I08154c94 into sc-dev
* changes:
  Flip ArrowTipView when it goes beyond screen height.
  Add more education tips for widgets. (3/3)
2021-06-10 20:46:20 +00:00
Steven Ng
bc5099e9a6 Fix height estimation of the widgets recommendation table
There are two vertical paddings
1. Table padding
2. Widget cell padding

We haven't taken account the widget cells padding

Test: Manual
Bug: 189814077
Change-Id: I9b1dc9e880d4402b9c461d0024a0748c0afc408a
2021-06-10 16:57:40 +01:00
Stevie Kideckel
1059c30f3a Account for header margin depending on which header is selected
This removes jitter from incorrectly counting or not the margins for the
headers near the top of the widget picker list.

Bug: 189956230
Test: verified locally
Change-Id: I3eeddbf8a1fb7cca31fe2a12c28b0eb444de631b
2021-06-10 15:29:46 +00: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
4716ab3037 Merge "Use WidgetSizes to estimate widget size instead of custom calculation" into sc-dev 2021-06-08 19:11:25 +00:00
Steven Ng
84fe7e3a1e Merge "Exact widget sizes functionalities into an utility class" into sc-dev 2021-06-08 18:55:07 +00:00
Steven Ng
eb1617521c Merge "Use grid size as the upper bound for widgets' default size in initSpans" into sc-dev 2021-06-08 14:48:29 +00:00
Steven Ng
1d47d8c705 Use grid size as the upper bound for widgets' default size in initSpans
Test: In Pixel 4, drag a monthly view Google calendar widget to a new
      home page from the full widgets picker. The widget outline is
      correctly shown.
Bug: 189060113
Change-Id: I33113b29cc8923098de95f1d5eb14c2b02429de1
2021-06-08 14:15:50 +01:00
Steven Ng
7e06df2b50 Use WidgetSizes to estimate widget size instead of custom calculation
Also fix 2 bugs in WidgetCell
1. preview layout: padding is added to the AppWidgetHostView rather
   than the preview container. We shouldn't add padding to the size
   of the preview container.
2. widget_preview_shortcut_padding is a padding added to shortcuts but
    not widgets.

Test: Open full widgets picker and observe widgets are rendered
      correctly in the widgets recommendation table. Also, observe
      the generated bitmap images are correctly rendered.
      Run AddWidgetTest.
Bug: 189975670
Change-Id: I00db3200e0b61dc5e82f3c4bfdf34e197ea20314
2021-06-08 11:48:11 +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
Stevie Kideckel
acf27b6d64 Merge "Fix accounting for the position/offset of headers with collapsing views" into sc-dev 2021-06-08 08:37:25 +00:00
Stevie Kideckel
fd9bfd3aab Fix accounting for the position/offset of headers with collapsing views
The offset should be taken before views are modified, the position
should be taken after. This fixes an off by one issue when expanding a
header below another already expanded header.

Bug: 183378651
Test: verified locally
Change-Id: I4987d57846d7bcde23b76280f800f19350b3521e
2021-06-08 07:08:42 +00:00
Steven Ng
0062822976 Merge "Fix preview layout crash upon screen rotation" into sc-dev 2021-06-07 20:38:39 +00:00
Jay Aliomer
4049f539c2 Merge "Improve local color extraction handling." into sc-dev 2021-06-07 19:45:13 +00:00
Steven Ng
db4ec8ac1a Fix preview layout crash upon screen rotation
Preview layouts are rendered via LauncherAppWidgetHostView. These
layouts are not yet added to the launcher. And thus, there is no
LauncherAppWidgetInfo.

Test: When a preview layout is shown in the recommended widget section,
      rotate the screen. No crash is observed.
Bug: 190395009
Change-Id: Ib1d080a106681fbfe3a4293f9f51f9576ef9414b
2021-06-07 18:55:47 +01:00
Pierre Barbier de Reuille
7fca870571 Improve local color extraction handling.
Local color extraction doesn't happen if the wallpaper is not currently
visible, so we don't need to add/remove the locations when the widget is
visible/hidden.

Also now compare the locations with some approximate measure, to account
for possibly slightly different calculations during drag vs drop.

Fix: 189827568
Test: Install Clock or test widgets and try to move them: the color are applied correcly.
Change-Id: Ib2a08bb0552c75bd351868e4fd5b5df8b8b732b2
2021-06-07 13:01:28 +01:00
Stevie Kideckel
6f3081affa Merge "Fix corner radius for expanded widget picker list items" into sc-dev 2021-06-04 20:50:52 +00:00
Steven Ng
5063805a4e Merge "Include widget padding & boarder spacing in widget preview size estimation" into sc-dev 2021-06-04 17:45:29 +00:00
Steven Ng
4a0e1b40f3 Include widget padding & boarder spacing in widget preview size estimation
Test: Sideload Google dev clock and verify the 5x5 widget preview is
      rendered correctly.
      Verify conversation widget preview is rendered correctly in the
      full widgets picker and priority flow (aka pin widget flow).
Bug: 189975670
Change-Id: I4b0212ae347044c970ba40b9b33439448a6aa941
2021-06-04 15:31:22 +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
Stevie Kideckel
d93feeba0a Fix corner radius for expanded widget picker list items
Also create the drawables at runtime to avoid all the permutations

Fix: 189329394
Test: verified locally
Change-Id: I0497759ff68bd4ae6b1635423cfd4713f06d349f
2021-06-04 13:04:04 +00:00
Stevie Kideckel
d7dc5702f6 Use scrollToPositionWithOffset in widget list and account for padding
Also, scroll after collapsing as well to preserve the header position.
LinearLayoutManager seems to not count/double count the top padding of
the RecyclerView when scrolling to the position. Scrolling with the
offset and deducting the top padding works around the issue.

There's still some occasional weirdness that needs to be investigated,
but this works well...most of the time.

Bug: 183378651
Test: locally
Change-Id: I0ba85fb65411991ef781f08a69faaa993a7d7fd0
2021-06-03 16:18:32 +00:00
Stevie Kideckel
f15214597e Merge "Scroll to the selected widget picker row after headers are clicked" into sc-dev 2021-06-03 14:15:00 +00:00
Stevie Kideckel
5cc44eb73e Merge "Use the LayoutManager as the source of truth for visible positions" into sc-dev 2021-06-03 11:00:32 +00:00
Stevie Kideckel
eb367e471b Scroll to the selected widget picker row after headers are clicked
This keeps the row in view. Currently, this will scroll the row to the
centre-bottom of the screen due to the top padding being double counted,
but that will remedied in a future CL.

This also resolves the issue where the last row's widgets aren't visible
by handling that case specially

Fix: 188665456
Bug: 183378651
Test: verified locally
Change-Id: I9acb9087a8cdaf130ac5955c810c96462b368f36
2021-06-03 09:48:21 +00:00
Stevie Kideckel
abd33b38e2 Use the LayoutManager as the source of truth for visible positions
During animations, the view group child may not correspond to the
visible views that appear at the top.

The previous logic is kept in the case that the layout manager returns
null for any reason, which can happen before layout has occurred for the
position.

Fix: 189588014
Test: verified locally
Change-Id: Ie8b5dcef50287e9e90a21f86e30a1ebcbbcba30f
2021-06-03 09:36:22 +00:00
Alina Zaidi
8796707172 Update scrim in widget pickers.
Also adjust padding in pin widget bottom sheet.

Test: Tested manually
Bug: 189802334
Change-Id: Ic25547ab1519139afdbf07aaefeb9168cf3501ff
2021-06-02 20:39:28 +01:00
Alina Zaidi
8a8c36cca9 Merge "Add more education tips for widgets. (2/3)" into sc-dev 2021-06-01 17:34:18 +00:00
TreeHugger Robot
04ef35f854 Merge "Further adjust work profile tabs paddings in the widgets picker" into sc-dev 2021-06-01 13:13:03 +00:00
Alina Zaidi
f2c79dea0d Add more education tips for widgets. (2/3)
Show education dialog on WidgetsFullSheet.
-Have a button in widget education dialog to intent into PixelTips apps.
-Make sure arrow tip view shows after dismissing education dialog on
WidgetsFullSheet if there is a widget to show it on.
-Update colors and layout for arrow tips.

Test: Tested manually
Bug: 185354491
Change-Id: I5cbdd02fc4f19a49a42dac4451b071e3d604747f
2021-06-01 13:58:18 +01:00
Steven Ng
a0d49dcfb4 Further adjust work profile tabs paddings in the widgets picker
Test: Open widgets picker and observe tabs paddings are correctly set.
Bug: 188872382
Change-Id: Ib6a735bf2b0710f86b8641533cadb27116049341
2021-06-01 11:40:36 +01:00
Steven Ng
755723403b Merge "Don't dismiss keyboard after clicking X button on the widgets search bar" into sc-dev 2021-06-01 10:05:26 +00:00
Steven Ng
7a36ad396e Don't dismiss keyboard after clicking X button on the widgets search bar
Test: Enter some queries in the widgets search bar. Click X button. The
      keyboard is still opened after the search queries has been erased.
Bug: 189454318
Change-Id: Icb0501cf36cbf1517e2da24044da44101fa86ed9
2021-05-27 18:42:31 +01:00
Pierre Barbier de Reuille
0bb96c9168 Merge "Update the computation of the widget span from size" into sc-dev 2021-05-27 12:11:27 +00:00
Stevie Kideckel
d9abe11b92 Merge "Add the DefaultItemAnimator, without change animations" into sc-dev 2021-05-26 22:21:03 +00:00
Pierre Barbier de Reuille
295a402908 Update the computation of the widget span from size
The new computation takes into account the new cell layout border
spacing.

Change-Id: Ic20e0906bbbaaf1e53475585e2a6ca31c277e09b
Bug: 187461595
Test: Manual testing, varying the sizes in a widget
2021-05-26 22:44:58 +01:00
Steven Ng
b7773f93cf Adjust the widgets fitting algorithm to mitigate over packing issue
If we are fitting more than one widgets / shortcuts on the same row,
we will only allow the total width to be n - 1 cells, where n is the
grid width in cells.

Test: Run WidgetsTableUtils robolectric test.
Bug: 189103942
Change-Id: I2f23cb08fe95d68562188cc7b1852d99d7093dc0
2021-05-26 19:27:46 +01:00
Stevie Kideckel
47f935dbbe Add the DefaultItemAnimator, without change animations
Change animations cause the addition of another view to be able to
crossfade/interpolate the two. Disabling change animations prevents us
losing the focus when a header row changes due to expanding or
collapsing.

Test: verified locally
Bug: 183378651
Change-Id: I07837b41748b5206936321c08d376069fa81b363
2021-05-26 17:08:18 +00:00
Stevie Kideckel
fa7c98ee45 Merge "Remove intrinsic padding from widget previews" into sc-dev 2021-05-26 09:27:11 +00:00
TreeHugger Robot
17385ce33e Merge "Fix full widgets picker fast scroller height." into sc-dev 2021-05-25 21:43:40 +00:00