Commit Graph

45 Commits

Author SHA1 Message Date
Tony
1787ee9596 Peek overview on motion pause, then animate fully on touch up
Add AnimationComponents.ATOMIC_OVERVIEW_PEEK_COMPONENT, and rename
previous ATOMIC_COMPONENT to ATOMIC_OVERVIEW_SCALE_COMPONENT.

When SWIPE_HOME is enabled:
- Overview lives to the left of Workspace, which is encoded in
  LauncherState.NORMAL.getOverviewScaleAndTranslation().
- Create atomic animation based on ATOMIC_OVERVIEW_PEEK_COMPONENT
  and OVERVIEW_PEEK state when swiping and holding from home screen.

Bug: 111926330
Change-Id: Iab6dbef7238dae15b3036d4b2a026b781eee6b4b
2019-03-27 19:45:04 -05:00
vadimt
42a88b9681 Sending state ordinals from Launcher to TAPL
This improves diagnostics.

Test: TAPL tests
Change-Id: I0ebb533513405372ea7c58a36910160cfb6d8368
2019-02-14 13:08:01 -08:00
Sunny Goyal
8b2b4e24ee Adding support for swipe and hold to overview from home screen to all-apps
- After the atomic animation ends, overview jumps slightly because the
  normal -> all apps transition puts it at a different position than
  normal -> overview

Bug: 111926330
Change-Id: I6ca359b3ef2fc4d0b6b96229d8bf118bd0db9649
2019-01-28 15:51:19 -08:00
Jon Miranda
7e390c3b17 Revert "Revert "Add spring to shelf for home <-> overview <-> all apps state transitions.""
This reverts commit 2bdac8f7e5.

Reason for revert: Reverting and added fix to crash

Change-Id: I20508eb05c85ba5dfba52630aa9becea270f890b
2019-01-08 16:43:45 -08:00
Jonathan Miranda
2bdac8f7e5 Revert "Add spring to shelf for home <-> overview <-> all apps state transitions."
This reverts commit e018711aac.

Reason for revert: investigating crash

Change-Id: I157b61a9f1bd46e2fcd3f2f883d3b5c23ca314af
2019-01-05 00:04:20 +00:00
Jon Miranda
e018711aac Add spring to shelf for home <-> overview <-> all apps state transitions.
Added new SpringObjectAnimator class that wraps an ObjectAnimator so the
Object can be controlled via the Animator or via a SpringAnimation. It extends
ValueAnimator so that it remains compatible with AnimatorPlaybackController.

Code is behind feature flag toggle QUICKSTEP_SPRINGS.

Bug: 111698021
Change-Id: I1b20179ede37e89a6a6bb2a45d407cc74c99ac4e
2019-01-04 11:12:53 -08:00
Tony
6cfb0edb41 Fix end state when animating launcher after swipe up from an app
Previously we were comparing the controller's progress at the time of
the end of the animation... which is always 1. Instead, we should be
comparing the effective final progress based on the interpolator.

Change-Id: I18110b5a3b914839860931187f39cfa11182b3e2
2018-11-29 11:35:16 -08:00
Sunny Goyal
8c79668069 Merge "Using velocity tracker for computing the velocity of motion events" into ub-launcher3-master 2018-09-25 21:15:26 +00:00
Hyunyoung Song
24b209c65a Swipe down on status bar
Bug: 111839343

Change-Id: I5332dc098af980b4d4ef45b095586d68975ad98c
2018-09-18 11:11:04 -07:00
Sunny Goyal
4d8ec15fb5 Using velocity tracker for computing the velocity of motion events
Change-Id: I14f2f970825a2936f4bb285834405d67daf8667c
2018-09-13 09:50:47 -07:00
Vadim Tryshev
b6398a1eb8 Sharing protocol constants between Launcher and TAPL
Bug: 110103162
Test: TaplTests
Change-Id: I5b2a2b8576a7a6ea4a156f00858711496d6b5bba
2018-08-14 19:53:43 -07:00
Vadim Tryshev
2ce6a13f60 Tapl library
The public API of the library has finalized; flakiness has been removed;
code polished.

Bug: 110103162
Test: TaplTests suite
Change-Id: Ic156bbfeedb1cb9c4a48ef907f97e396e8e81936
2018-07-20 14:43:05 -07:00
Tony Wickham
520ffec9d3 When controlling atomic components, bound to remaining progress
Before, we were just controlling the components as far as we had left,
which was fine since they are just a subtle effect anyway. But now that
we don't fade out until the very end, this means that long swiping from
home usually kept recents in the background during the entire swipe and
then abruptly disappear after letting go. Now we make sure the entire
atomic animation plays by the time we reach all apps, so recents will
fade out in all cases.

Bug: 79867407
Change-Id: I7cb6790d9055bc76b4b73ed761604042a308c987
2018-06-21 13:38:53 -07:00
Jonathan Miranda
48010091f4 Merge "Adjust interpolators when swiping from overview to all apps" into ub-launcher3-edmonton-polish 2018-06-21 00:30:02 +00:00
Tony Wickham
17be4e71b2 Adjust interpolators when swiping from overview to all apps
- All apps content fades in quickly so that icons are opaque by the time
  they are on screen
- Recents fades out late so that we don't see it as translucent while
  the transition is continuing (the translucent icon top of tranclucent
  task view looks bad, for instance)
- Fix colored scrim that appears over recents - was using 0 to 1 instead
  of 255

Bug: 79867407
Change-Id: I4f50423157f7870c8d0708f586a72e3e5a7b6559
2018-06-20 16:58:21 -07:00
Tony Wickham
c0b468c990 Merge "Don't intercept above shelf progress if still animating" into ub-launcher3-edmonton-polish 2018-06-19 22:04:17 +00:00
Sunny Goyal
2b03b713f7 Fixing atomic animation not getting completed properly
> Finishing the atomic animation to that proper states are applied
> Offsetting the duration of atomic animation so that it completes along with
  the swipe animation

Bug: 80432882
Bug: 86308723
Bug: 80549582
Change-Id: I8a3b44c2c7017e241b2fbdbb96c5d67edbb359d1
2018-06-12 17:08:55 -07:00
Tony Wickham
29aef52be3 Fix some issues with haptic
- Don't have double haptic on quick scrub
- Correctly check interpolated progress to determine final state,
  so that it always aligns with the haptic (i.e. passing the haptic
  means letting go will go to the new state)

Bug: 109709720
Change-Id: I702bb76a4c15f932f923e81a14cc49f6a9126cb8
2018-06-11 23:23:49 +00:00
Matthew Ng
c4b75abf3b Added haptic feedback when swipe/fling up from an app in fullscreen
This includes swiping/fling up from a fullscreen app and swiping/fling
down a task to a fullscreen app.

Test: swipe up when app is fullscreen
Fixes: 80543530
Change-Id: Iee259284cc6d4fe1e784532f0822ffd38cdee280
2018-06-11 10:45:47 -07:00
Tony
89126653cd Don't intercept above shelf progress if still animating
When you swipe up to overview from home, we should allow touches on
recents even if the overshoot animation isn't finished. If the
touch is below the all apps progress, we continue to intercept to
allow for double swipe up.

Bug: 80093992
Change-Id: Ifdca61e7cfc1f7a713c067596cc0c1bd3154b44e
2018-06-07 20:48:04 -07:00
Sunny Goyal
87a6ad18cd Fixing controller state is not properly cleared when the animaiton is cancelled.
This was leading to a pending animation running while the state had changes,
leaving user in an inconsistent state.

Various atomic animation fixes
> Ensuring that there is only one success listener on atomic animation, so that atomic
  controller is created only once and to the final mToState
> If atomic controller is already running, skip animating the atomic conmonenets as
  part of main animaiton
> Cancel atomic controller if it is going to a different state

Bug: 80549582
Bug: 109583168
Change-Id: Ie7a032e0fa73b1f1c2ef53055c08d16444f0385e
2018-06-05 16:07:29 -07:00
Tony Wickham
422e1f9c69 Only log swipe interaction on swipe end
Previously we were logging new states as we swipe past them; now we just
log the start and end states when lifting your finger.

Bug: 80102083
Change-Id: Icec6c3dab1441023a3cdcadb7b56ecef8313cb8c
2018-05-23 13:20:10 -07:00
TreeHugger Robot
39ac161095 Merge "Add mStartState to determine if user swipes up from Home." into ub-launcher3-edmonton 2018-05-23 17:57:58 +00:00
Jon Miranda
1d19e2f152 Start springs for All Apps when user flings up.
Bug: 77695481
Change-Id: Ifecfbbb89601947118f620f522662aee8a61946e
2018-05-23 09:13:07 -07:00
Tracy Zhou
788c051493 Add mStartState to determine if user swipes up from Home.
Bug: 80146880
Test: Manual test
Change-Id: Ia0743bff3f2a5b3998a798743138b012ec461a94
2018-05-22 16:25:37 -07:00
Tony Wickham
4e21c1b552 Cleanup how we set back button alpha
Add BackButtonAlphaHandler to set back button alpha, instead of setting
it from multiple places.

Also force back button alpha to be 1 if swipe up is disabled (b/80091187)

Change-Id: I49b63a0e6b033a3a947a847669a398f1b9ff0564
2018-05-22 11:05:01 -07:00
Tony Wickham
f9d38098ca Merge "Fix a couple issues with swiping up from home" into ub-launcher3-edmonton 2018-05-18 16:50:47 +00:00
Matthew Ng
8b92fe336b Fade back button in and out tied with the overview/shelf (2/3)
Back button changes opacity when moving the shelf during swipe up
between home screen and overview. The alpha changes depending on the
progress of the swipe up animation. When going from app to home and vice
versa, the fade animation does not tie with the swipe up progress. The
fade animation also masks the back button drawable when ime visibility
changes.

Change-Id: I51e42930640ba711e81880b385bb722d7ee8ad33
Fixes: 74581837
Fixes: 76900236
Test: swipe up from home screen to overview
2018-05-18 00:48:51 +00:00
Tony Wickham
7de574175b Fix a couple issues with swiping up from home
- Don't update the animation to go from 0 to 1; instead, update the
  interpolator to clamp to the remaining progress (b/79773309)
- Fix NPE that can happen in a race between the atomic animation
  ending and the non-atomic animation canceling/ending

Change-Id: I313251dc5cbd7b931b043fc3e840bb4ab368a790
2018-05-17 16:30:46 -07:00
Tony Wickham
b2ddf10041 Update interpolators and durations for state animations
When we enter overview (overview appears, workspace disappears):
- Workspace scales down from 1f to .8f with OvershootInterpolator(1.2f) at 200 ms
- Workspace fades from 1f to 0 with OvershootInterpolator(1.2f) at 200 ms
- Overview scales down from 1.33f to 1f with OvershootInterpolator(1.2f) at 200 ms
- Overview fades from 0 to 1f with OvershootInterpolator(1.2f) at 200 ms

When we exit overview (overview disappears, workspace appears):
- Workspace scales up from .92f to .1f with DecelerateInterpolator() at 200 ms
- Workspace fades from 0 to 1f with AccelerateInterpolator() at 200 ms
- Overview scales up from 1f to 1.1f with AccelerateInterpolator() at 180ms
- Overview fades from 1f to 0 with DecelerateInterpolator(1.7f) at 200 ms

Parallax while the finger moves: Workspace translates half the distance as the shelf

Bug: 79776746
Change-Id: I319d982cf202bcd6dbbcd68ffc5c0c7853629c7e
2018-05-16 15:59:31 -07:00
Tony Wickham
0f640b6c1b Make fling thresholds consistent
There are 3 places we can block a fling:
- Swiping from home to all apps (through overview)
- Swiping from an app to all apps (through overview)
- Dismissing a task (in the same gesture that started by swiping down)

In all of these cases, we block the fling when crossing the threshold
to a new state (e.g. OVERVIEW), but unblock if the user pauses their
drag. With this change, the logic is consistent:
- Unblock the fling after pausing a short amount of time
- If a fling was blocked, increase the settling duration based on
  velocity

Bug: 78089840
Bug: 78658678
Change-Id: I5ef52b74229418b867b26c3c6d3db2cf6e48914b
2018-05-16 13:47:20 -07:00
Tony Wickham
fc564f1477 Don't end atomic animation when passing through state
Previously we were ending the atomic animation with the assumption
that it should be complete/almost complete by the time you drag to
the next state. However, it is very easy to drag quickly enough where
that assumption doesn't hold, and thus you just see the atomic
animation pop to the end (i.e. recents showing without animation).

Now instead of ending the atomic animation, we let it continue. But
because the new state animation will have an atomic component that
interferes with the still playing atomic animation, we have to
control the atomic component separately; we control the non-atomic
components until the atomic animation ends, at which point we create
a separate controller to control the atomic components.

Bug: 76449024
Change-Id: Ia4bf19e26d0838f952d9e500fbdd8aba19856a41
2018-05-09 12:36:02 -07:00
Tony Wickham
6becf7c07d Add atomic recents animation while swiping up
State handlers can now specify atomic and non-atomic components of
their animations to states, which can be specified when creating a
new animation. There is now one atomic animation, when going from
NORMAL to OVERVIEW (and in reverse):
- RecentsViewStateController's animation (scale/alpha) is all atomic
- WorkspaceStateTransitionAnimation has atomic and non-atomic:
  - Hotseat and workspace alpha is atomic, as is workspace scale
  - Everything else (scrim, translation, qsb and drag handle alpha) is
    non-atomic
- All apps progress is non-atomic

Also simplified dragging through overview; no longer pulls against you,
so we use an OvershootInterpolator when flinging instead of our custom
interpolator for the spring effect.

Bug: 76449024
Bug: 78089840
Change-Id: Iafac84d0c2b99ee9cf9dd5b30e2218286713b449
2018-05-09 12:33:46 -07:00
Tony Wickham
fa6cbbe15b Cleanup swipe detector in case of double cancel
We manually dispatch cancel when returning to the previous state in
onDragEnd(), but could end in a bad state if getting a second,
external cancel (e.g. by pressing home). Thus, we restore the
onCancelListener after manually dispatching cancel.

Bug: 79258868
Change-Id: Idc4c33cede1d8af1829a4a744b9348d379bcf8f7
2018-05-04 13:17:46 -07:00
Tony Wickham
52240a3aa0 Only detect swipe directions that lead to new states
This cleans up the code and ensures that the current state animation
is always initialized when we get drag events.

Also log when we pass through states.

Bug: 78017680
Change-Id: I54ab42923ed539940ea708973ad65f5793669c11
2018-05-03 14:04:25 -07:00
Tony
31fbd4c08b Fix some state issues with user-controlled animations
Previously, user-controlled animations weren't properly being canceled when a
non-user-controlled animation started, e.g. when hitting home. Thus, we could
end in the wrong or inconsistent state because the user-controlled animation's
end runnable was still used. Now we add a cleanup callback for when we reset
the user-controlled animation for one that isn't user-controlled.

Also fixed a couple typos.

Tests (easier with animation durations extended):
- Swipe up and hit home before reaching overview -> land on home
- Go to overview, swipe down slightly (before threshold to go to workspace)
  and let go -> return to overview without flash (recents was resetting)
- Swipe up, press home while swiping -> goes home, stops responding to drag
- Start dismissing task and hit home before it finishes (or while dragging)
  -> goes home, stops responding to drag

Bug: 78249220
Change-Id: If11d8999e3fadba38c987b25af67cd2304cd859b
2018-05-01 13:45:27 -05:00
Jon Miranda
83337f9e8e Call close for AbstractFloatingViews that were removed while still open.
I'm not sure how/when this case occurs (perhaps during some transition/state
change), but manually removing the floating view matches the symptoms in the
bug.

Bug: 72996404
Change-Id: I1e7c1a338fcd16c8e07b3c49fb9c9b2097eb2708
2018-04-25 11:25:40 -07:00
Sunny Goyal
ed2d2bcbb8 Force finish any pending animations if the insets or orientation change
Some animation might be running from a previous orientation, which can cuase property changes
to get skipped.

Bug: 77848165
Bug: 77774619
Change-Id: I3e198196192746abdd72a1970ff2ef407bf4aff9
2018-04-20 20:53:16 +00:00
Tony Wickham
9ae484b95d Merge "Log dismissing or launching recent tasks" into ub-launcher3-master 2018-04-06 22:55:50 +00:00
Tony Wickham
9bd862e588 Log dismissing or launching recent tasks
We now pass the log action (e.g. SWIPE or FLING) to the pending
animation, so that the end listener can log appropriately. This
is used when swiping down or up on a task, for example.

Bug: 73783784
Change-Id: I5c2eee24e8b23cf4af68d503d3435a6d8088dd8a
2018-04-06 15:41:39 -07:00
Tony Wickham
6270a0ea18 When dragging past first or last state, don't reinit target
Example bug:
1. Swipe up to overview and let go
2. Swipe all the way to the top of the screen, past where all apps stops
3. Swipe down

Before this change, you get reset in NORMAL state instead of OVERVIEW.

By ensuring that getTargetState() checks the drag direction before
returning a new state, we guarantee we only re-init in the case that the
state is actually changing. Otherwise it's possible to change the state
to one that is impossible, such as NORMAL when swiping up from ALL APPS.

Change-Id: I19913dded9c94228d06289780b6400e99403f378
2018-04-06 14:32:18 -07:00
Tony Wickham
1c6f12d119 Swipe down on hotseat to launch recent task
If you're ever in overview and swipe down on the hotseat, it will launch
the focused task *unless* you entered overview from the workspace and
have not scrolled past the first task. This is a hidden state to allow
for reversibility of the swipe up from workspace.

Also moved PendingAnimation from quickstep to launcher3.

Change-Id: Iea077bc0ef7c74f6bf7b98d0a638892b9c5fe36c
2018-04-03 11:20:49 -07:00
Tony Wickham
274b9529ff Support swiping between states
- Swiping down on hotseat from overview goes to workspace
- Can swipe up through overview to get to all apps

Bug: 76449024
Change-Id: I7f76d92da976e268cc2a97e55746cca4603e6620
2018-04-03 11:18:18 -07:00
Sunny Goyal
7a80b59e97 Swipe interaction changes on home screen
> Increasing the distance to travel for the first swipe
> Adding support for custom interpolators when building an animation
> When quickly swiping twice from home, finished the first animation

Change-Id: Ibc3c8667e9b927376fd99f08f0ca027f2398914b
2018-03-21 17:55:35 -07:00
Sunny Goyal
7185dd63eb Changing the overviewState to show appsearch and floating header
Change-Id: I2cfd61cfc9978e4c8e4520f0f7217e49e7344c79
2018-03-19 20:02:34 -07:00