Commit Graph

73 Commits

Author SHA1 Message Date
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 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 7c74e4ae64 No more UserHandleCompat
Bug: 32745285
Change-Id: I762fb4e268c1afe48a1860ab12a4ccb3f626aa95
2016-12-15 22:06:10 -08:00
Sunny Goyal 6c46a6d324 Using java_style enum generation for proto
This makes it easier to track various method parameters and simplifies
debug logging

Change-Id: Ib7c3d52590d0c36b2c8460c889ee3bead3454569
2016-12-15 09:30:35 -08:00
Sunny Goyal 0f76b56865 Refactoring FlingToDelete
> Moving all fling related logic to FlingToDeleteHelper from DragController
> Removing fling related methods from DragSource and DropTarget
> Moving fling animation logic from DeleteDropTarget to FlingAnimation
> Simplifying DropTargetBar to directly look for all valid drop targets.
  This makes it easier to add new DropTarget in xml.

Change-Id: I7214d2d30c907ab93c80d92d9f9be6dda2d63354
2016-12-13 23:39:16 -08:00
Sunny Goyal dde4fd971e Changing DeepShortcutManager to have a singleton contructor instead
of getting it from LauncherAppState

This follows the design of other managers and makes it easier to access it
from other processes and non-ui thread.

Bug: 33032833
Change-Id: I8ad82ae5b6cc47bae885f9896985675c7dd0d5b8
2016-11-21 22:28:23 +05:30
Tony Wickham d80ebdfd9f Intercept touches in DeepShortcutContainer after moving beyond touch slop
Otherwise it's possible for a long press to trigger when swiping
on a shortcut, which causes it to drag far away from the finger.

Bug: 32309824
Change-Id: I40bd5c1daac49d6edb59744083a1e23dcf4f0ce6
2016-10-31 13:32:26 -07:00
Tony Wickham 04a8ec4fc6 Consume touch events in DeepShortcutsContainer
Previously, touches along the horizontal area next to the
deep shortcuts arrow went through to the background, allowing
things like going to overview with the shortcuts still open.

Bug: 32477287
Change-Id: I82d21d3051a13b23dfaac19e93facee120968aaa
2016-10-27 17:01:32 -07:00
Tony Wickham c92fe89327 Don't allow multiple shortcuts to be dragged simultaneously.
When starting a drag when another is already in progress, the
original drag view is left dangling until launcher is killed.

Bug: 32231238
Change-Id: I5ff94b82971c539231f8f588059dc84845cc88f0
2016-10-21 11:37:25 -07:00
Sunny Goyal 740ac7f00e Refactoring floating view opening/closing logic
> Creating a base view for floating panels with some common methods
> Moving the getOpen method to individual classes
> Moving the folder icon animation logic to folder icon
> Moving all the logic related for opening folder to Folder class

Change-Id: I898dfb6870b857cb921d2729b89618bc43ff2e88
2016-10-10 13:36:03 -07:00
Hyunyoung Song df7ef68bbf Refactors in UserEventDispatcher
- LaunchSource -> LogContainer

Change-Id: I71bfee992fb1ba7ae80e824d419f7bf8d3020999
2016-10-06 17:52:22 -07:00
Tony Wickham 10236d6ac7 Update pre-drag lifecycle for apps with shortcuts.
- First of all, deferred drag has been renamed to pre-drag
  to avoid confusion with the existing deferred end drag.
- For normal drags, the cycle is still startDrag -->
  onDragStart --> onDrop --> onDropComplete --> onDragEnd.
- Pre-drags have two additional callbacks: onPreDragStart
  and onPreDragEnd. onPreDragStart is called between
  startDrag and onDragStart, and onPreDragEnd is called
  at the same time as onDragStart or onDragEnd.
- If the pre-drag has not transitioned to a full drag before
  onDragEnd, onDragStart and onDropComplete are skipped
  (onDrop is still called to allow the DragView to animate).

Change-Id: Icd7a8f75d5fcc159f9a52758c22ab6eae3edb9e2
2016-10-04 12:26:35 -07:00
Sunny Goyal 7a372033ac Merge "Exposing custom actions using keyboard shortcut" into ub-launcher3-master 2016-10-03 21:12:20 +00:00
Tony 5eea1e89dd resolve merge conflicts of 6e74e89 to ub-launcher3-master
Change-Id: I34e449ca3a91ee06e1983ac3a83cb7ca53567a91
2016-09-23 19:43:35 -07:00
Tony Wickham 6e74e899d3 Refactor shortcuts drag and drop.
- Instead of creating our own drag view within the container, and
  handling logic to determine when to start a real drag, we start
  the drag immediately and just defer onDragStart().
- To determine when the deferred drag should start, we add a
  DeferDragCondition to DragOptions. The default DeferDragCondition
  never defers a drag, but is overridden for apps with shortcuts
  to defer until the icon is dragged a given distance.
- Because the drag is handled in DragController, including checking
  when to start the deferred drag, DeepShortcutsContainer no longer
  needs to handle touch events and ShortcutsContainerListener has
  been removed.

This change has several immediate benefits:
- The code is much cleaner, because it allows touch handling to be
  done by the DragController through the normal drag flow, without
  recreating logic in ShortcutsContainerListener/DeepShortcutContainer.
- The janky second haptic feedback has been removed (now it vibrates
  when you long press, like everywhere else, but not again when the
  shortcuts close after dragging a distance).
- Drops are animated, instead of just popping the icon back into place.

Bug: 30769920
Bug: 30465972
Bug: 31533078
Change-Id: I679b412b72fbf6c3895d76963311eb5010c8e8db
2016-09-23 18:44:47 -07:00
Sunny Goyal c2f72b0bb8 Merge "Resize only one widget at a time" into ub-launcher3-master 2016-09-23 23:23:03 +00:00
Sunny Goyal 6ad72f02fd Resize only one widget at a time
> Removing logic to have multiple widgets in resize mode
> Making ResizeFrame a touch controller, so that it fits well with
other touch interaction in drag layer
> Chaning the method names in touch controller, so that it do not
overlaps with the default View methods

Change-Id: I85d4dbdfc82d078781adbce137dfaaea59c9c83d
2016-09-23 16:02:49 -07:00
Sunny Goyal 66b24572e4 Exposing custom actions using keyboard shortcut
Keyboard shortcuts:
  ctrl+A => Open all apps
  ctrl+S => shows deep shortcuts
  ctrl+O => shows custom actions popup

This also removes the direct delete/uninstall key shortcuts, making
actidental icon removal less likely

Bug: 24065447
Change-Id: Iae63370c0f33620628567cffd4df024064d4d02e
2016-09-23 15:57:08 -07:00
Tony Wickham f2e075133e Move shortcut fade interpolator outside of loop.
am: e5a00c6172

Change-Id: I7b2c15b04a7656b136f5d6f0c54f13030c5b9563
2016-09-22 21:09:19 +00:00
Tony Wickham af86c004d2 Fade deep shorcuts in and out.
am: b318c0e396

Change-Id: Ib31d1878822ec42ad8fdfcfd78636ea4b2472cae
2016-09-22 20:08:40 +00:00
Tony Wickham e5a00c6172 Move shortcut fade interpolator outside of loop.
Change-Id: I64806897afcd1062dfbaefd6dca07f024f7346af
2016-09-22 13:01:46 -07:00
Tony Wickham b318c0e396 Fade deep shorcuts in and out.
Animate open:
- Stagger-fade shortcuts as they open
- Become fully opaque before fully open, at which point the
  arrow animates in (scale). This way there is no overlap of
  a translucent shortcut over an opaque arrow.

Animate close:
- Stagger-fade shortcuts as they close
- Delay fade until arrow animation is finished, to ensure
  there is no overlapping of translucent and opaque.

This is much less visually jarring when quickly dragging
and dropping apps with shortcuts.

Bug: 31533078
Change-Id: I8673ee64e92414c718233ea89b70362187e53696
2016-09-22 12:50:58 -07:00
Tony Wickham daf30c1505 When shortcuts close, only set text visible if not in hotseat.
am: 12624a5a17

Change-Id: I0c6fedcb89d626e3bddca98610ec3da808cdc68e
2016-09-20 21:05:17 +00:00
Tony Wickham 4125386687 Merge "When shortcuts close, only set text visible if not in hotseat." into ub-launcher3-calgary-polish 2016-09-20 20:49:37 +00:00
Tony Wickham 01486a1e65 Fix deferred shortcut container removal.
am: ec383dfc63

Change-Id: I3a2d582f3834f9034e46eebd67815fa890b520b0
2016-09-09 00:07:47 +00:00
Tony Wickham ec383dfc63 Fix deferred shortcut container removal.
- Previously, the drag listener listener was removed from the
  container as soon as it started animating closed, which got
  rid of its opportunity to complete the deferred removal.
- The deferred removal now calls close(), which does further
  cleanup including updating the app icon's text visibility.

Bug: 31248681
Change-Id: I18e545e7e19e50b7d47e23a5beb8f254ba1a4ccf
2016-09-08 13:58:35 -07:00
Sunny Goyal 10629b077c Moving some image handling classes to .graphics package
Change-Id: Id6d3d0b9c345a503ff2e09f073eb4b6449e21c7e
2016-09-02 12:34:33 -07:00
Sunny Goyal 52851aa3fd Fixing topView not being considered in all places when calculating accessible
and focusable views

Bug: 30563273
Change-Id: I6253ce33ee5c328efdde2ea733029975b31e5eb8
2016-09-02 10:52:07 -07:00
Sunny Goyal 94b510cc68 Some drag and drop code refactor:
1) Adding DragOptions to easily extend drap functionality
2) Changing onDragStarted signature to send more information
3) Updating states for dropTargetButton based on drag event directly
4) Removing folder item based on onDragStarted and not startDrag

Change-Id: I65b684e092ddc081d086bfe2c8c1973ed170eaeb
2016-09-01 15:55:13 -07:00
Hyunyoung Song 59a238095e Support user event logging for drag and drop
b/30039490

Supported in this CL:
- DnD: drag from container [WORKSPACE|HOTSEAT|FOLDER|ALLAPPS|WIDGETS|DEEPSHORTCUTS]
       drag to container [HOTSEAT,WORKSPACE,FOLDER,DROPTARGETS]
- Source and target can be [FOLDER_ICON, ICON, DEEPSHORTCUT, WIDGET]
- $ adb shell setprop log.tag.UserEvent DEBUG will turn on debugging

Change-Id: I0b8b879b80e6dce85bbde6e7794f9e0677832603
2016-09-01 12:47:12 -07:00
Tony Wickham 12624a5a17 When shortcuts close, only set text visible if not in hotseat.
Bug: 31195155
Change-Id: I3ee6f45f1dd421fcad6ed22b444efd2922b0a32b
(cherry picked from commit e53abfa993f94dea119d99221ea5bbdba87303cb)
2016-08-30 23:12:57 +00:00
Sunny Goyal c9a0a7c62f Merge "Moving the shortcut application logic to the DeepShortcutView. This makes the logic for accessing various properties consistant and and ties it to the UI of the DeepShortcutView." into ub-launcher3-calgary-polish 2016-08-15 17:13:16 +00:00
Tony Wickham d8f951f923 Log shortcuts open on ACTION_UP instead of in showForIcon().
am: be06874c81

Change-Id: Iefc3b03644c2c197f0b744bb9f42fd3058624377
2016-08-12 20:36:40 +00:00
Sunny Goyal 5836bf728e Moving the shortcut application logic to the DeepShortcutView.
This makes the logic for accessing various properties consistant and
and ties it to the UI of the DeepShortcutView.

Bug: 30817556
Change-Id: I09536b9f91b2a9969fcc286f83dd2b17e16cd9ce
2016-08-12 11:10:12 -07:00
Tony Wickham be06874c81 Log shortcuts open on ACTION_UP instead of in showForIcon().
- We only want to log when the container is opened and potentially
  used, not when a long press is followed by a drag-and-drop.
- Also cleaned up code that was determining the container of the
  app icon, since LaunchSourceProvider.fillInLaunchSourceData()
  can do that instead (it's more robust and consistent).

Bug: 30791570
Change-Id: I05b6750f26182fda8a9940ac66f1371c2d228ca9
2016-08-10 18:26:41 -07:00
Tony Wickham 64624c80fc Change drag from shortcuts to say "Cancel" instead of "Remove"
am: df64e9ee06

Change-Id: I27b16b2f526034b50012b65d032098b75f86a754
2016-08-09 22:03:54 +00:00
Tony Wickham df64e9ee06 Change drag from shortcuts to say "Cancel" instead of "Remove"
Bug: 30757836
Change-Id: I7d2d97898bd1feac3cd7ba15614c29a1e1b33841
2016-08-09 11:07:46 -07:00
Tony Wickham 988e2b7a4d Make padding consistent between shortcuts and the app icon.
This change makes the padding consistent regardless of where the app
is (e.g. folder vs workspace vs all apps) by ignoring the app's
padding and adding our own to the shortcuts container.

Also note that this padding is relative to the icon, excluding the
text beneath it. So we also hide the text when the container opens
downwards, and re-show it when the container closes.

Bug: 30604007
Change-Id: I6e51c4983a8b5d495833f86e483ebaa229ed2099
2016-08-05 11:17:42 -07:00
Tony Wickham f0cb6018dd Merge "Start shortcuts close animation where open left off." into ub-launcher3-calgary 2016-08-03 20:09:44 +00:00
Sunny Goyal a659bfe3d2 Updating content description for the shortcuts menu and announcing
it when the container is opened

Bug: 30587453
Change-Id: I6f2d3ba05593f3e2a1a8f05c66a0f80e76932c38
2016-08-02 16:16:16 -07:00
Tony Wickham 0ba81607e3 Start shortcuts close animation where open left off.
- Before we always started the close animation at 0 instead of
  the previous open progress, which looked janky.
- Shortened the animations' durations and start delays to
  account for the fact that the open animation was only
  partially finished when the close animation started.

Bug: 30465231
Change-Id: I958ee5f4543dbf1185f3d0229c55fc1b51929655
2016-08-02 11:09:16 -07:00
Tony Wickham 55c6691e3a Add logging for shortcuts opening.
- Log as long press with child type DEEPSHORTCUTS container
- Parent type can be one of WORKSPACE, HOTSEAT, FOLDER,
  ALLAPPS, PREDICTION, or SEARCHRESULT.

Bug: 30537079
Change-Id: Ie62e4889ee06c845f959ca998781787a7fdaf00e
2016-08-01 17:55:07 -07:00
Tony Wickham 1460475626 Merge "Set shortcuts arrow pivot to side connected to container." into ub-launcher3-calgary 2016-07-30 00:04:14 +00:00
Tony Wickham 4d5887bd8c Set shortcuts arrow pivot to side connected to container.
Bug: 30508528
Change-Id: Iddc733d79b680010785d21b347d151bc23bffc23
2016-07-29 16:34:17 -07:00
Sunny Goyal 66d17ca32d Merge "Badging shortcuts with app icons" into ub-launcher3-calgary 2016-07-29 23:14:51 +00:00
Tony Wickham c39edf54e6 Filter shortcuts down to 4 if there are more.
- We take the first 4 in sorted order, except we remove up to 2
  static shortcuts to make room for dynamic ones if they exist.
- Added ShortcutFilterTest with testSortAndFilterShortcuts().
  This asserts that the filtered list is sorted and has the
  expected number of static and dynamic shortcuts based on
  inputs with various amounts of each.

Bug: 28980830
Change-Id: I832b6b21144f17c74bb8b90a840d6620e99911b8
2016-07-29 16:10:43 -07:00
Sunny Goyal 79cf718fcd Badging shortcuts with app icons
Change-Id: I3fa005ece20a54b31f823acb28c384ecdf1eafb1
2016-07-29 16:06:36 -07:00
Tony Wickham 6257bc327b Merge "Prevent opening shortcuts container if one is already open." into ub-launcher3-calgary 2016-07-29 01:14:22 +00:00
Tony Wickham c714c0148b Stop setting original icon visible when dragging app with shortcuts.
- This was leaving a "ghost" icon behind, which looked really weird.
- We still need to make it visible for All Apps, or else you can get
  in a state where the icon is gone from all apps indefinitely.

Bug: 30465972
Change-Id: I79eacf2dfdb0cd267732ae63ef69a9bb193933a5
2016-07-28 11:35:55 -07:00
Sunny Goyal a2454ad2d8 Launcher shortcuts animations update.
> The shortcut container closes with an animation
> When opening/closing the animation only the icon scales
and not the title and drag handle
> When dragging the icon, it starts from the original icon position and
moves under the user finger. The container grows to follow the drag view.

Bug: 28980830
Change-Id: Ic0353c30b682d1f018cbf4d62e8a6e8e7d7d4664
2016-07-27 17:37:23 -07:00