Commit Graph

6115 Commits

Author SHA1 Message Date
Jon Miranda
cda3bfb2e1 Remove unused View parameter from ofFloat method.
Change-Id: I5fabd5c78de52ba68b67e0b1bd7208f4d1f7cbea
2017-02-06 15:54:41 -08:00
Tony Wickham
e1fa0145d3 Merge "Gracefully ignore items that don't support notifications" into ub-launcher3-master 2017-02-03 18:24:14 +00:00
Tony Wickham
18a1b5da36 Gracefully ignore items that don't support notifications
PackageUserKey is only meant to be used for items that support
notifications, so when trying to update it for an item that
doesn't, we don't use it to check if the item has notifications.

This fixes a crash that happens when trying to update notifications
for a legacy shortcut, as such a shortcut doesn't have a component
on its intent, which we were trying to use to populate PackageUserKey.

Bug: 34842278
Change-Id: I8c69ccebbf9d93505d5b29ecd25d76c65610ddc4
2017-02-02 15:37:18 -08:00
Hyunyoung Song
3c7d9cbb20 Clean up around 1) Log.VERBOSE and 2) dump
b/31772480

Note: in the follow up CL, I will add the dump result of the bgDataModel
to a proto

Change-Id: I5261cff0fb29cedd1dd772b8b15f67095ad5b967
2017-02-01 15:11:08 -08:00
Tony Wickham
1fafd719cb Merge "Ensure getNotificationKeysForItem() returns empty on unsupported items." into ub-launcher3-master 2017-02-01 19:10:37 +00:00
Tony Wickham
4d096298ce Ensure getNotificationKeysForItem() returns empty on unsupported items.
We were bypassing the check in getBadgeInfoForItem(), which meant
we would return notifications based on package/user regardless of
the item type. In particular, deep shortcuts would show notifications
when long-pressed.

Bug: 34866646
Change-Id: I6575a28539313c0c5d0eea1cbf7b7726f747bcd5
2017-02-01 09:58:40 -08:00
Mario Bertschler
5a2edd65f2 Fixes a bug where the workspace doesn't properly enter into freescroll mode
hence the overscroll will appear and you can wrongly enter into the -1 screen.

The problem was that the state value in the workspace was set after enabling
free scroll, but enabling free scroll checks the current state for validation.

This bug was introduced by Icc3005fd431569e2b9e3f52d2249de8ba8d13eab.

Bug: 34817798
Change-Id: I46802c93c49a2ae8ee5c40ef24e465d7fe63c4bb
2017-01-31 23:21:37 +00:00
Tony Wickham
bdbfd5bb3a Merge "Use notification icon views' tags to store NotificationInfo." into ub-launcher3-master 2017-01-31 22:38:37 +00:00
Hyunyoung Song
ea383c312c Changes required to use MaskableIconDrawable inside Launcher3
This CL will bake the legacy icons inside a grey background

Note: There will be follow up CL to change the color and shadow of the
legacy icon. The idea of this CL is to first test if MaskableIconDrawable
methods and class work properly.

Bug: 32063838
Bug: 33553066

Change-Id: I3d02e619fcb0cd9879baa22a025b5d95c829f26c
2017-01-30 12:18:08 -08:00
Tony Wickham
72e1688019 Merge "Ensure notification icons have enough contrast with background." into ub-launcher3-master 2017-01-27 23:34:19 +00:00
Sunny Goyal
dec3a908bf Updating the preview generation logic so that it aligns better with
the drag source image

> Using common code for pending item drag (WidgetContainerView and PinItemDragListener)
> Adding a shortcut-circuit in Workspace when a pendingItem can create a shortcut
  directly. Previously the multi-window drop was routing through onActivityResult which
  was causing some state information to be lost.

Bug: 33584624
Change-Id: I0259870032185713caa9bff27092dbae6ce91199
2017-01-27 15:09:10 -08:00
Tony Wickham
1f0b5347b8 Use notification icon views' tags to store NotificationInfo.
Previously we had a mapping from View to NotificationInfo,
but this way we don't have to maintain that separate mapping
and can follow the pattern used throughout the rest of launcher.

Change-Id: Ia988f822613b9978bab3d0127226de920a3e73c9
2017-01-27 14:28:42 -08:00
Tony Wickham
f79877c04c Ensure notification icons have enough contrast with background.
This uses the same color calculations as the system, except that
we use the extracted notification background instead of assuming
it is white.

Bug: 32410600
Change-Id: I7be8b9459ca38d01a6780758898541e69ec42576
2017-01-27 12:43:31 -08:00
Sunny Goyal
5cfd1158ec Merge "Handing pin item drag when workspce is not loaded" into ub-launcher3-master 2017-01-27 17:58:34 +00:00
Sunny Goyal
8a0dc38aeb Improving widget handling for pinItemRequest
> Preloading widget view while dragging for smoother
  transition
> Skipping config activity and sending confirmation to
  the caller when widget is dropped

Bug: 33584624
Change-Id: Ib23e5964298296d12d9c93f38aefdf924a07368e
2017-01-27 09:35:18 -08:00
Tony Wickham
9f1612cddd Merge "Store notification keys in a List instead of a Set." into ub-launcher3-master 2017-01-26 23:38:02 +00:00
Tony Wickham
2efcdd0c78 Store notification keys in a List instead of a Set.
This will preserve the order when iterating over the notifications to
populate the popup container.

Bug: 34735689
Change-Id: Ic390ffef140e454566ffc6ab1763950349df25ce
2017-01-26 11:28:43 -08:00
Tony Wickham
30e45187a8 Add and update some comments badging/notifications.
Change-Id: Iab4e837c9be01cbd7764c8920e36c6d8159e16dd
2017-01-26 09:24:41 -08:00
Tony Wickham
9438ed414f Add swipe-to-dismiss notifications in popup menu.
- Next secondary icon animates up to replace dismissed main notification
- Add padding around main notification so it always aligns with the
  straight edges of the view (not the rounded corners); looks more
  dismissable
- Notification view collapses as notifications are dismissed
- To mimic system notification behavior, we copy SwipeHelper,
  FlingAnimationUtils, and Interpolators. We also apply elevation
  to notifications and reveal a darker color beneath when dismissing.

Bug: 32410600
Change-Id: I9fbf10e73bb4996f17ef061c856efb013967d972
2017-01-25 17:36:31 -08:00
Sunny Goyal
2bcb3fb1f3 Handing pin item drag when workspce is not loaded
While the launcher is loading, the drag view is displayed with a gray tint.
The drag is started, as soon as the workspace is unlocked

Bug: 33584624
Change-Id: I4013ea8b987ec305e73742b194f9e96af761cc35
2017-01-25 15:31:42 -08:00
Tony Wickham
f3d02e4716 Merge "Refactor DeepShortcutsContainer to PopupContainerWithArrow" into ub-launcher3-master 2017-01-25 22:23:53 +00:00
Sunny Goyal
38d480a32d Merge "Fixing loadWorkspace" into ub-launcher3-master 2017-01-25 20:53:01 +00:00
Tony Wickham
540913eadf Refactor DeepShortcutsContainer to PopupContainerWithArrow
- Also added PopupItemView, which takes animation logic from
  DeepShortcutView, and which DeepShortcutView now extends.
- Renamed ShortcutFilter to PopupPopulator, which has support
  for new item types (not yet used). Also moved populating
  logic (e.g. UpdateShortcutChild Runnable) to PopupPopulator.

Bug: 32410600
Change-Id: Ib6e444ac7ca99c80ba438801c26e62d9542e0ad9
2017-01-25 11:21:47 -08:00
Tony Wickham
43a2f42978 Merge "Add NotificationListener to launcher." into ub-launcher3-master 2017-01-25 18:18:25 +00:00
Tony Wickham
010d255018 Add NotificationListener to launcher.
- NotificationListener extends NotificationListenerService, and is
  added to the manifest.
- Added PopupDataProvider, which contains logic for storing and
  interacting with data that goes into the long-press popup menu
  (shortcuts and notifications). A follow-up CL will rename
  DeepShortcutsContainer to a generic PopupContainerWithArrow.
- If Launcher has notification access, NotificationListener will
  get callbacks when notifications are posted and removed; upon
  receiving these callbacks, NotificationListener passes them to
  PopupDataProvider via a NotificationsChangedListener interface.
- Upon receiving the changed notifications, PopupDataProvider maps
  them to the corresponding package/user and tells launcher to
  update relevant icons on the workspace and all apps.

This is guarded by FeatureFlags.BADGE_ICONS.

Bug: 32410600
Change-Id: I59aeb31a7f92399c9c4b831ab551e51e13f44f5c
2017-01-25 09:51:06 -08:00
Sunny Goyal
657bf0fcd1 Merge "Adding support for drag and drop for requestPinItem." into ub-launcher3-master 2017-01-25 17:36:43 +00:00
Sunny Goyal
81e4491450 Fixing loadWorkspace
> Adding checks on legacy shortcuts
> Checking restore status based on package and not componentName

Bug: 34123342
Change-Id: I442699e4ebb34ae66aa25c512bfcdc1b4fd5ae2a
2017-01-24 22:55:36 -08:00
Sunny Goyal
b38fab7573 Adding support for drag and drop for requestPinItem.
On long pressing, the confirmation activity starts a system
drag-n-drop and focuses the launcher activity. We then drive
the launcher drag controller using the system drag event

Caveats:
> We use a transparent preview for system drag and drop and use
  a view inside launcher for actual preview. This gives us better
  control over various animations.
> The parameters for drag operation are passed to the Launcher
  activity using the intent. Since onNewIntent and onDragEvent
  come at different times and are not associated, a random uuid
  is used as mime-type to match the drag event with intent params
> If the workspace is locked (eg, loader is running) the drag
  operation is simply dropped. Will be imporved in follow up cls

Bug: 33584624
Change-Id: I0bb5b25b690f86b6af31a14e11beb669fcb3a281
2017-01-24 22:24:54 -08:00
Mario Bertschler
ab45ec0c23 Merge "Fixes a bug to not be able to scroll widgets intoduced when enabling to swipe allapps from everywhere." into ub-launcher3-master 2017-01-25 02:09:01 +00:00
Mario Bertschler
248c575cca Fixes a bug to not be able to scroll widgets intoduced when enabling
to swipe allapps from everywhere.

The fix is to determine if the widget is scrollable on layouting instead
of the callback when a widget has been updated.

Bug: 34641906

Change-Id: Idc9d8ade7e601279b87856333ae754f4785131ac
2017-01-24 12:01:44 -08:00
Sunny Goyal
658058b960 Adding some widget addition flow tests
> Added two dummy widget providers: with config and without config
> Added tests for verify widget config flow

Change-Id: I4577f085abe8f8b82047b644c71cc9065358153a
2017-01-23 15:28:25 -08:00
Sunny Goyal
04a324afb7 Adding WidgetAddFlowHandler to handle widget addition and configuration.
This will allow us to override the implementation and provide custom
logic for widget addition.

Bug: 33584624
Change-Id: I310bf39e301c7e1c8de4f62456594535e2fe5bbc
2017-01-23 10:54:30 -08:00
Sunny Goyal
0e452ecfdb Merge "Using WidgetCell in the Pin Item confirmation prompt for a consistent UI Also fixing some platform API changes in PinItemRequestCompat" into ub-launcher3-master 2017-01-21 00:03:01 +00:00
Sunny Goyal
65513ba58c Using WidgetCell in the Pin Item confirmation prompt for a consistent UI
Also fixing some platform API changes in PinItemRequestCompat

Bug: 33584624
Change-Id: I255829f0079f1a3967bf8d6a337da12c890eb7ec
2017-01-20 15:44:15 -08:00
TreeHugger Robot
331ade2bab Merge "Fix shortcuts alignment in landscape" into ub-launcher3-master 2017-01-20 21:23:38 +00:00
Tony Wickham
10bf35ff1a Fix shortcuts alignment in landscape
- Take left inset into account.
- If there is no way to orient the shortcuts next to the icon,
  instead center it in the drag layer and don't draw the arrow.
- If possible, place the shortcuts to the left or right of the
  icon when centered vertically. If for whatever reason that
  isn't possible, center the shortcuts horizontally as well.

Bug: 33421656
Change-Id: I838b30ea487e0f7c64637db1cb8991ca3ee16bf9
2017-01-20 12:30:24 -08:00
Sunny Goyal
dbb28b2bf8 Merge "Adding support for new APIs in O related to configurable shortcuts" into ub-launcher3-master 2017-01-20 18:35:08 +00:00
Sunny Goyal
a2441e88ff Updating widget preview generation to not embed any badge.
Instead drawing badge in the view directly.

This will allow us to reuse the same preview when we do not want to draw
badges. This also simplified badging of shortcut config activities.

Change-Id: I9c07c33bf9c2b8ef81a00026b1d42587868c906f
2017-01-19 14:00:40 -08:00
Sunny Goyal
782f0c9a89 Adding support for new APIs in O related to configurable shortcuts
> Config activities can now return PinItemRequest which can be used to pin
  deep shortcuts

Bug: 33584624
Change-Id: Ic0df436bd79e069615b9d60d24eb7594b824b2da
2017-01-19 13:54:31 -08:00
Sunny Goyal
278359539c Adding support for requesting addition of shortcut/widget
on the workspace.

Bug: 33584624
Change-Id: I664366822fe8088742faff2cce006239ab0771bc
2017-01-18 18:38:34 -08:00
Sunny Goyal
627006eeb4 Merge "Moving icon generation out of ShortcutInfo constructor so that it can be created on the UI thread" into ub-launcher3-master 2017-01-18 23:48:53 +00:00
Tony Wickham
197f97bde4 Merge "FastBitmapDrawable can draw an icon badge (notification count)" into ub-launcher3-master 2017-01-18 22:36:17 +00:00
Sunny Goyal
1b0726359b Moving icon generation out of ShortcutInfo constructor so that it
can be created on the UI thread

Change-Id: If84e52041eb4ab20807f5cfd4b7f31d7b5f381ed
2017-01-18 11:30:59 -08:00
Sunny Goyal
a3db1fc674 Merge "Only marking items not already restored as restore" into ub-launcher3-master 2017-01-14 20:03:10 +00:00
Sunny Goyal
f7740433ed Merge "Fixing AppWidgetsRestoredReceiver updating model on UI thread" into ub-launcher3-master 2017-01-13 23:00:40 +00:00
Sunny Goyal
bde762c618 Merge "Loading proper app icon if the associated activity is null" into ub-launcher3-master 2017-01-13 20:37:53 +00:00
Tony Wickham
9a8d11f930 FastBitmapDrawable can draw an icon badge (notification count)
- Added BadgeInfo to contain data to be shown in a badge
  (currently just notification count).
- Added BadgeRenderer in DeviceProfile to contain things
  relevant to drawing the badge, such as size and Paint's.
- Added IconPalette to compute colors for the badge based
  on a dominant color (will also be used for notifications)
- FastBitmapDrawable uses these classes to draw the badge.

Bug: 32410600
Change-Id: I6595a4879943357590f7d20c22594691a573ecaf
2017-01-13 10:58:10 -08:00
Sunny Goyal
c1ad0ce8ae Only marking items not already restored as restore
> Moving the restore property to LoaderCursor

Bug: 34123089
Change-Id: I1f992ef086d65e0b3cf18d3b2cf37a4f254c97d2
2017-01-13 10:38:41 -08:00
Sunny Goyal
761d49a7a1 Merge "Removing promiseIntent property from ShortuctInfo" into ub-launcher3-master 2017-01-13 18:34:53 +00:00
Sunny Goyal
e6e7200791 Removing promiseIntent property from ShortuctInfo
> Instead of checking promiseIntent != null, using isPromise() for consistency
> Fixing bug where clicking a pending icon does not launch anything
> Fixing bug where draging an icon on Info target, permanently hides the icon

Change-Id: Ic8f6b56042dba42d5ed9aedb0f5947186e1a4208
2017-01-12 18:54:21 -08:00