Commit Graph

37 Commits

Author SHA1 Message Date
Steven Ng 3417c1d22b Remove debugging logs from the full widgets picker
Test: None
Bug: 185508758
Change-Id: I2958118abc9d4f3778aaf6c3e3df01b0712354dc
2021-04-28 19:27:40 +01:00
Alina Zaidi 9f531ee6c4 Always check for availability of widgets before changing visibility of
recycler view and no widgets view.


Bug: 186117900
Test: Tested manually
Change-Id: I57ac95fee935a54ce70f5793f0b0686b549cbf9e
2021-04-28 10:36:46 +01:00
Alina Zaidi 80732f89e7 Fix some widget picker recommended widgets bugs.
- Bind recommended widgets only when not in search mode. (b/183503774)
- Bind recommended widgets in onAttachedToWindow, Recommended widgets
are available in PopupDataProvider at this point. (b/185461866)

Bug: 183503774
Bug: 185461866
Test: tested manually
Change-Id: If24e5b2b3e69a695821b5f7d9f42ff4c89ae62fc
2021-04-21 15:26:01 +01:00
Steven Ng 8c8d99f966 Fix flaky widget tapl tests
Potential issues:
1. Widgets floating tips view is being shown
2. Header visible height is too small to be considered as a scroll
   gesture

Test: Run AddConfigWidgetTest, AddWidgetTest, BindWidgetTest &
      RequestPinItemTest
Bug: 185733371
Change-Id: Ic3e9188724dd920349ce8d8e8d98392b94b40642
2021-04-20 23:01:19 +01:00
Steven Ng 9ad5b60c6c Merge "Use availableHeightPx to calculate the max height for recommended widgets" into sc-dev 2021-04-20 10:33:32 +00:00
Alina Zaidi b89c991bab Merge "On exit search in widget picker, make recommended widgets table visible only if recommended widgets are available." into sc-dev 2021-04-20 09:54:29 +00:00
Steven Ng 769a14ef34 Use availableHeightPx to calculate the max height for recommended widgets
heightPx doesn't take device orientation and system taskbar into account.

Bug: 185508758
Test: Open widgets tray, observe recommended widgets. Rotate the screen
      and observe recommended widgets.
Change-Id: I96f1817f96ba643e54e1d2599225254489091d03
2021-04-19 22:06:38 +01:00
Alina Zaidi 1869a9868c On exit search in widget picker, make recommended widgets table visible
only if recommended widgets are available.

This fixes missing scroll bar on exit search issue (b/183616305)

Bug: 183616305
Test: Manually tested
Change-Id: I3ced5fb2f833f3d34b7dfd376bb4b7c231bc28f6
2021-04-19 20:02:17 +01:00
Alina Zaidi 45b8e48a69 Merge "Only setup widget adapters once after inflation" into sc-dev 2021-04-17 19:15:11 +00:00
Steven Ng 29f6b0ba05 Add debug logs for widget recommendation down scale calculation
Bug: 185508758
Test: None
Change-Id: I0b4789075bcc5ffc26f30dcd483f7c97bee9f410
2021-04-16 18:39:45 +01:00
Steven Ng ffde1471e4 Only setup widget adapters once after inflation
Bug: 185587905
Test: Switch to a new Guest user. Then, quickly open the all widgets
      picker and scroll to the bottom. The widgets picker no longer
      scroll to top even after app icons are loaded.
Change-Id: I1ffef95af56935d101d12520a20be97931d1429d
2021-04-16 18:02:23 +01:00
Alina Zaidi 1e849a95f9 Merge "Add education tip to widget picker." into sc-dev 2021-04-13 19:26:30 +00:00
Alina Zaidi 120d6476f6 Add education tip to widget picker.
A tip is shown on the first widget/shortcut in the recommended table.
If there are no recommended widgets, a tip is shown on first widget
in an expanded header.

There is a delay of few milliseconds, to let the WidgetCells be
completely rendered on screen before getting their location.

Test: Manually tested
Bug: 184920163
Change-Id: I2637e84e7fc467b27888023434e3578a4b8ed4d6
2021-04-13 16:47:04 +01:00
Alina Zaidi 1ccd7efaf0 Fix UI bugs for widget picker search.
- Mirror search icon in RTL (b/184162989)
- Fix spacing between edit text and cancel button, to make it consistent
with space between search icon and edit text. (b/183602001)
- Scroll to top on every search result. (b/183602001)
- Fix keyboard overlap on orientation change. This is fixed by clearing
text on edit text differently (b/184048899)

Test: Manually tested
Bug: 184162989
Bug: 183602001
Bug: 184048899
Change-Id: I72ed51e1968a55a3105bd8b389d1bbd74d50d8af
2021-04-13 10:41:18 +01:00
Sunny Goyal ce6cc7e705 Simplifying widget search pipeline
Bug: 183607616
Test: Verified on device
Change-Id: I3e5dd9e280f375475d1e1cf41dff6e6533175ebf
2021-03-30 16:54:34 -07:00
Sunny Goyal c5797893e7 Using edgeEffect for overscroll in all-apps and widget tray
Bug: 183966408
Test: Manual
Change-Id: Iea1b67504fc59fc7ce2ec657bf8ac7e3d8bfff1c
2021-03-29 12:35:39 -07:00
Alina Zaidi 2cff164be2 Clear focus from search bar whenever a header is clicked in search adapter.
Test: Manually checked
Bug: 183398749
Change-Id: Ie91312ae1e62c6427e3397d1e5f60bc812a790ee
2021-03-24 09:52:45 +00:00
Alina Zaidi 76060eb11b Bug fixes for widget picker search (2/n)
- Dismiss keyboard when user starts to drag widget picker
- Add content description for cancel button

Test: Tested manually.
Bug: 183211445
Bug: 183106676
Change-Id: Ie620c3d50a49d8380f316d48e4ee8ebced6de5eb
2021-03-23 12:53:23 +00:00
Steven Ng f3814eea2d Merge "A11y fix for all widgets tray (Part 2 / n)" into sc-dev 2021-03-22 10:22:54 +00:00
Steven Ng e85b5565c6 A11y fix for all widgets tray (Part 2 / n)
Fix the focus change when expanding / collapsing an app in
the all widgets tray by adding stable ids and disable item
animator.

Item animator is also disable even accessibility isn't enabled
because the default item animator also disrupts the header
padding. It also makes the expansion / collapsing of widgets table
very unpredicible.

Test: Navigate all widgets tray with talkback on.

Bug: 183120145
Change-Id: Ib1e2ea4d543757248e635a834204db688532cbfa
2021-03-19 23:58:19 +00:00
Steven Ng 4235fc129c Renders widget recommendations
Update the tapl test logic to scroll a smaller distance to avoid the
search bar blocking the target touch area.

Test: Open full widgets sheet and observe the widget recommendations
      shown at the top.
      Run AddConfigWidgetTest

Bug: 179797520

Change-Id: I6d53bbb46e2cb928ed7d015aaac604be17d33178
2021-03-19 21:11:32 +00:00
Alina Zaidi c4f3f49805 Fix bugs for Widgets picker Search UI.
- On orientation change, clear search bar.
- Change text and search bar color to make similar to mocks/ all apps search bar.
- Fix search recycler view visual bugs.
- If back is pressed in search mode, exit search mode instead of exiting widget picker.

Test: Manually seen widget picker on phone.
Bug: 183103133
Bug: 183103936
Bug: 183115050
Bug: 157286785
Change-Id: I056f089eada84d00133038f4a3d7b18bc51be564
2021-03-19 14:42:47 +00:00
Alina Zaidi 2e732e95d9 Bug fixes for widget picker search.
SearchBarController
- Use Extended Edit Text to handle close keyboard action well.
- On press enter while search remove focus from bar and hide keyboard.
- On cancel button press hide keyboard and also reset search targets to empty so that on next search session the previous results dont flash (show for a short time before reflecting users query).

WidgetsFullSheet
- Make sure expanded header are reset when user leaves personal/work recycler views. Search recycler view resets its expanded header on every search already.
- Show 'no search results' view if no search result present.
- Update WidgetListBaseRowEntryComparator to show personal profile widgets first.

Test: Tested prototype locally.
Bug: b/157286785
Change-Id: Ibaa208c4091783e14ac0887caf559e867185df5a
2021-03-17 14:43:04 +00:00
Alina Zaidi 1632752a72 Have an interface for WidgetsSearchBar so Nexus Launcher can override the search bar.
Test: Tested prototype locally.
Bug: b/157286785
Change-Id: I263063a451862755efe3d6e4a5a2eb69f2ea29b8
2021-03-16 09:25:22 +00:00
Alina Zaidi e17f4651d0 Merge changes from topic "SEARCH_INTEGRATE" into sc-dev
* changes:
  Add a WidgetsSearchBar(Launcher3) and a WidgetsSearchController.
  Have a recycler view to show search results.
2021-03-15 13:24:20 +00:00
Steven Ng 53d1364e8b Better estimate the height of widget recycler view
Test: Expand and collapse apps in the widgets picker. Then, observe
      the height of the fast scroller is correctly displayed.

Bug: 181629430
Change-Id: I9efcf902f8548fc5c8a398609758d43123228e5e
2021-03-12 22:58:45 +00:00
Alina Zaidi 334e65935b Have a recycler view to show search results.
-Have a recycler view layout for search widgets list.
-Make WidgetsFullSheet implement interface- SearchModeListener to get notified when user is using search and also when search results are ready.
-Have a WidgetsListSearchHeaderViewHolderBinder for search result headers which shows subtext in header as concatenated string of widget/shortcut labels.
-Modify WidgetsListAdapter and WidgetsDiffReporter to work well with search recycler view.

Test: Tested prototype locally. Also added robolectric test.
Bug: b/157286785
Change-Id: Ie29d9f295fddb6d727b5fc26a360f514f2f4a763
2021-03-11 21:27:51 +00:00
Steven Ng d73d6e56a9 Show an empty view when there is no widget available
Test: Remove all widgets from work profile using TestDpc. Observe
      empty view is shown in the full widget tray. Add back some
      widgets to work profile and observe widgets showing up in the
      full widgets tray

Bug: 179797520
Change-Id: I2e1fcb5a0014568a4674e2bcc0a3ed3c6ec5a44a
2021-03-10 17:36:37 +00:00
Steven Ng ae6b34811b WidgetCell & LiveWidgetPreview cleanup
The fixes are:
1. For widgets shown in TableRow, aligns them center vertically.
   This is useful when widgets of different height are shown in
   the same row.
2. Remove background color from WidgetCell
3. Re-enable swipe in FullWidgetsSheet
4. Use the WidgetCell image as the single & long press area because
   1. Previews are now scaled to their default size. The touch area
      should already be larger for widgets that are bigger than 2.4
      cells
   2. WidgetCells also render description. If the user long press the
      description area, the drag view will not align in the middle of
      the user touch / drag area.

Test: Drag-n-drop widgets from FullWidgetsSheet, BottomWidgetsSheet
      and pin widget flow.
      In FullWidgetsSheet, swipe left and right to switch work /
      personal tab.

Video: https://drive.google.com/file/d/1Ur7PwF1a7iwGGRTZczfc0BSVu-Ta6-Vm/view?usp=sharing

Bug: 179797520
Change-Id: I6fe4bc88d1e1b35b1819d8d7f046105f5ed27043
2021-03-08 21:22:08 +00:00
Steven Ng 7f7b2f7ee9 Fix scrolling bugs in full widgets sheet
Bugs:
1. Layout margins were not taken into account
2. Fast scroller offset has a different scale to the recycler view
3. Update padding & margin in onMeasure rather than in onLayout

TODO: fast scroller measurement doesn't take into account of
      expanded item. It naively use the same height for all items
      from the recycler view adapter.

Test: Open full widgets sheet for both work profile and non-work
      profile setup. Scrollbar initial position is correct. Scroll
      up and down to confirm views vertical translation is correct.

Video: https://drive.google.com/file/d/1kp3iSm23RVk_otBNeYalEPPkWjjWMOY0/view?usp=sharing

Bug: 181629430
Change-Id: I398a94510751782e78aa8f426f37b03ecca8ec99
2021-03-05 11:44:47 +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
Steven Ng 05cc458dbf Merge "Show widget previews in their expected cell sizes" into sc-dev 2021-03-01 10:10:15 +00:00
Steven Ng 11773f47d2 Show widget previews in their expected cell sizes
1. Show widget previews in their expected cell sizes.
2. Update the bottom picker to use a table layout rather than
a horizontal scrollbar.
3. Move the title and cell size description to the bottom of
the preview.

Test: Run AddConfigWidgetTest
      Manually open full and bottom widgets picker and observe
      widget previews.
      Video: https://drive.google.com/file/d/1K8A8hK5B4FgPTsX3cb-Yt4a_VjI0pk-w/view?usp=sharing
Bug: 179797520
Change-Id: I938612cb2e2477ce4a3a2d6c8891a0a36fc0978c
2021-02-26 17:47:32 +00:00
Steven Ng 167f81b931 Add a header container view to the widgets full sheet
A header container view will contain
1. A horizontal bar: for indicating the popup view can be dragged
   to dismiss:
2. A title view: a title of the widgets full sheet popup view.
3. A search bar: for widgets / shortcut search. Since we will be
   making the fallback search algorithm available in AOSP, the
   search bar will now live in the Launcher3 codebase.
4. Recommended widgets (coming soon...)

This CL also added a scroll effect which gradually collapses the
title view when the user scrolls down the recycler view. The title
view will gradually restore its height when the user scroll to the
top of the recycler view.

Test: Manually test widgets pickers in work profile and non work
      profile setup. Verified the fast scroll bar works well in
      both setup.
      With searchbar: https://drive.google.com/file/d/19grUHL_LspLhMD_5p6-i0CiMW1FpflmD/view?usp=sharing
      Without searchbar: https://drive.google.com/file/d/1KRPgEAESHUhJDo1UJsQN80JO1c9Y8Nhl/view?usp=sharing

Bug: 179797520

Change-Id: If0016e3b3c693414897140e7912531ed9bd5deef
2021-02-26 10:03:36 +00:00
Steven Ng e8d92342fa Replace horizontal ScrollViews with tables in the full widgets picker
Test: Run gnl test, AddWidgetTest
      Run Robolectric tests for widgets
      Manual test video: https://drive.google.com/file/d/1uwCtVNIlC9150kv5eEfILfP5r5M7ARYm/view?usp=sharing

Bug: 179797520
Change-Id: I2f4cdf84338a91b63967879d0c9268c312ace19b
2021-02-24 19:49:15 +00:00
Steven Ng 391404fcb7 Add personal / work tabs for work profile widgets
Video: https://drive.google.com/file/d/1TORRNcvVM7fIvNd_WZaajLbI7D9z4VFA/view?usp=sharing


Test: Main profile only: run AddConfigWidgetTest.
      With work profile: manually launch the full widgets sheet.
      Go to the personal tab: only personal widgets are shown.
      Go to the work tab: only work widgets are shown
      Successfully add personal / work widgets from the full widgets
      sheet.

Bug: 179797520

Change-Id: Iad8b90c2af35e0580319d7a05510ec88e4f8b86c
2021-02-22 16:10:09 +00:00
Steven Ng 2f5648a911 Refactoring before adding a new view type in the WidgetsListAdapter
Changes made:
1. Model: added an abstract class for storing common information for
   entries shown in the full page widgets picker.
2. Introduced a ViewHolderBinder interface to split the logic of binding
   data to ViewHolder into separate classes.
3. Move the view holder binding of WidgetsListRow from WidgetListAdapter
   to its new class.
4. Move some widgets picker classes into a new picker package.

Test: Auto: Run WidgetsListAdapterTest, WidgetsListRowEntryTest and
      WidgetsListRowViewHolderBinderTest.
      Manual: open the all apps widgets tray and navigate the list.

Bug: 179797520
Change-Id: Iab29557842bb79156cad84d00a4c5d0db0c5aa06
2021-02-10 21:23:40 +00:00